function _video_image_get_thumb_file_object in Video 6.2
Same name and namespace in other branches
- 5 plugins/video_image/video_image.module \_video_image_get_thumb_file_object()
- 6 plugins/video_image/video_image.module \_video_image_get_thumb_file_object()
Create an image file object from a given image url
2 calls to _video_image_get_thumb_file_object()
- video_google_v_auto_thumbnail in types/
video_google/ video_google.module - Implementation of hook_v_auto_thumbnail
- video_youtube_v_auto_thumbnail in types/
video_youtube/ video_youtube.module - Implementation of hook_v_auto_thumbnail
File
- plugins/
video_image/ video_image.module, line 561 - Enable image support for video module.
Code
function _video_image_get_thumb_file_object($thumbnail_url, $id) {
// echo $thumbnail_url;
// exit;
//if($thumbnail_url && $thumbnail_url != '' && $image = image_gd_open($thumbnail_url, 'jpeg')) {
if ($thumbnail_url && $thumbnail_url != '' && ($image = image_toolkit_invoke('open', array(
$thumbnail_url,
'jpeg',
)))) {
//image_toolkit_invoke('open', array($back_image, $info['extension']));
// save image to temp directory for processing
$location = file_directory_temp() . '/' . $id . '.jpg';
image_gd_close($image, $location, 'jpeg');
// get info and build a file object
$filepath = file_create_path($location, file_directory_temp());
$info = image_get_info($filepath);
$file = new stdClass();
$file->filepath = realpath($filepath);
$file->filename = basename($file->filepath);
$file->filesize = $info['file_size'];
$file->filemime = $info['mime_type'];
return $file;
}
return null;
}