summaryrefslogtreecommitdiff
path: root/classes/File_thumbnail.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@status.net>2010-11-12 14:03:08 -0800
committerBrion Vibber <brion@status.net>2010-11-12 14:03:08 -0800
commit2c4313467f07cae059798ac500ec2a1c31953877 (patch)
treec47aeb8a6dd4c8351d956641f3f37b38ee020e43 /classes/File_thumbnail.php
parent65eeb7cba530e45b8d8a25644505619e8af63971 (diff)
Save oEmbed photo references as thumbnails if there's not a separate thumbnail_url entry in the return data. This fixes thumb saving for Flickr photo references.
Diffstat (limited to 'classes/File_thumbnail.php')
-rw-r--r--classes/File_thumbnail.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/classes/File_thumbnail.php b/classes/File_thumbnail.php
index d371b9e8a..17bac7f08 100644
--- a/classes/File_thumbnail.php
+++ b/classes/File_thumbnail.php
@@ -55,10 +55,21 @@ class File_thumbnail extends Memcached_DataObject
* @param int $file_id
*/
public static function saveNew($data, $file_id) {
- self::saveThumbnail($file_id,
- $data->thumbnail_url,
- $data->thumbnail_width,
- $data->thumbnail_height);
+ if (!empty($data->thumbnail_url)) {
+ // Non-photo types such as video will usually
+ // show us a thumbnail, though it's not required.
+ self::saveThumbnail($file_id,
+ $data->thumbnail_url,
+ $data->thumbnail_width,
+ $data->thumbnail_height);
+ } else if ($data->type == 'photo') {
+ // The inline photo URL given should also fit within
+ // our requested thumbnail size, per oEmbed spec.
+ self::saveThumbnail($file_id,
+ $data->url,
+ $data->width,
+ $data->height);
+ }
}
/**