function angular_media_simplify_file in CKEditor Widgets 7
Clean up file and add thumbnail url.
3 calls to angular_media_simplify_file()
- angular_media_callback_file in ./
angular_media.module - Callback to retrieve (GET) or save (POST) updates.
- angular_media_callback_upload in ./
angular_media.module - Callback that handles and saves uploaded files.
- angular_media_field_widget_form in includes/
angular_media.field.inc - Implements hook_field_widget_form().
File
- ./
angular_media.module, line 310 - Implementation of angular_media.module.
Code
function angular_media_simplify_file($file) {
$file = (object) $file;
if ($file->type == 'image') {
// Append unique suffix to prevent these images from being cached locally
$suffix = '&' . time();
$file->url = file_create_url($file->uri) . '?a' . $suffix;
$file->thumbUrl = image_style_url('media_thumbnail', $file->uri) . $suffix;
$file->previewUrl = image_style_url('media_preview', $file->uri) . $suffix;
$file->cropUrl = image_style_url('media_crop', $file->uri) . $suffix;
}
if (!empty($file->field_media_source)) {
$file->source = $file->field_media_source[LANGUAGE_NONE][0]['url'];
$file->attribution = $file->field_media_source[LANGUAGE_NONE][0]['title'];
}
if (!empty($file->field_media_license)) {
$file->license = $file->field_media_license[LANGUAGE_NONE][0]['licence'];
}
$file->name = $file->filename;
return $file;
}