]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/VideoThumbnails/VideoThumbnailsPlugin.php
Reset imgPath variable if VideoThumbnails failed
[quix0rs-gnu-social.git] / plugins / VideoThumbnails / VideoThumbnailsPlugin.php
index 3cdf07478e662f3ea2026a08feeddbd9aac8eb7c..23af7e00ac433676ae53f1e91c91f1feebd6dfd2 100644 (file)
@@ -58,11 +58,12 @@ class VideoThumbnailsPlugin extends Plugin
         // Let's save our frame to a temporary file. If we fail, remove it.
         $imgPath = tempnam(sys_get_temp_dir(), 'socialthumb-');
 
-        $result = exec('avconv -i '.escapeshellarg($file->getPath()).' -vcodec mjpeg -vframes 1 -f mjpeg -an '.escapeshellarg($imgPath));
+        $result = exec('avconv -i '.escapeshellarg($file->getPath()).' -vcodec mjpeg -vframes 1 -f image2 -an '.escapeshellarg($imgPath));
 
         if (!getimagesize($imgPath)) {
             common_debug('exec of "avconv" produced a bad/nonexisting image it seems');
             @unlink($imgPath);
+            $imgPath = null;    // pretend we didn't touch it
             return true;
         }
         return false;