diff scald_dailymotion.module @ 8:da69ba21d0c3

Check that the thumbnail is here before using it
author Franck Deroche <franck@defr.org>
date Mon, 26 Jul 2010 14:48:55 +0200
parents f3040f91b65d
children 1907129beb95
line wrap: on
line diff
--- a/scald_dailymotion.module	Tue Jul 20 11:57:23 2010 +0200
+++ b/scald_dailymotion.module	Mon Jul 26 14:48:55 2010 +0200
@@ -24,8 +24,11 @@
  * Implements hook_scald_fetch.
  */
 function scald_dailymotion_scald_fetch(&$atom) {
-  $atom->thumbnail_source = file_directory_path() . '/dailymotion/'. $atom->base_id .'.jpg';
-  $atom->file_source = $atom->thumbnail_source;
+  $file = file_directory_path() . '/dailymotion/'. $atom->base_id .'.jpg';
+  if (file_exists($file)) {
+    $atom->thumbnail_source = $file;
+    $atom->file_source = $atom->thumbnail_source;
+  }
 }
 
 /**