05/26/2017 at 9:08 am
#424190
Keymaster
@ Kenneth
Open the db in phpMyAdmin or similar tool. Copy the contents of the option column for an entry which has an image and unserialize it. That will show you the structure. Or use code:
$slug = 'http://image.jpg';
$slug = $entry->getSlug();
$photo = cnImage::download( $url, $slug );
if ( ! is_wp_error( $photo ) ) {
$entry->setImageLinked( TRUE );
$entry->setImageDisplay( TRUE );
$entry->setImageNameOriginal( $photo['name'] );
$entry->setOriginalImageMeta( $photo );
} else {
$entry->setImageLinked( FALSE );
$entry->setImageDisplay( FALSE );
}
Both cnImage::download() and cnImage::sideload() return the same response so they are interchangeable.
Hope that helps!
