This commit is contained in:
Marcin Kurczewski 2013-10-22 21:44:22 +02:00
parent 18097b6192
commit 87eaa9ba9e

View file

@ -587,6 +587,16 @@ class PostController
$srcImage = imagecreatefromgif($srcPath); $srcImage = imagecreatefromgif($srcPath);
break; break;
case 'application/x-shockwave-flash': case 'application/x-shockwave-flash':
$srcImage = null;
exec('which swfrender', $tmp, $exitCode);
if ($exitCode == 0)
{
$tmpPath = tempnam(sys_get_temp_dir(), 'thumb') . '.png';
exec('swfrender ' . $srcPath . ' -o ' . $tmpPath);
if (file_exists($tmpPath))
$srcImage = imagecreatefrompng($tmpPath);
}
if (!$srcImage)
$path = $this->config->main->mediaPath . DS . 'img' . DS . 'thumb-swf.png'; $path = $this->config->main->mediaPath . DS . 'img' . DS . 'thumb-swf.png';
break; break;
default: default:
@ -620,6 +630,9 @@ class PostController
$this->context->transport->mimeType = 'image/png'; $this->context->transport->mimeType = 'image/png';
$this->context->transport->fileHash = 'thumb' . $post->file_hash; $this->context->transport->fileHash = 'thumb' . $post->file_hash;
$this->context->transport->filePath = $path; $this->context->transport->filePath = $path;
if (isset($tmpPath))
unlink($tmpPath);
} }