function pleiofile_generate_file_thumbs(ElggObject $file) { if ($file->simpletype != "image") { return null; } $file->icontime = time(); $sizes = array(60 => "thumb", 153 => "tinythumb", 153 => "smallthumb", 600 => "largethumb"); $filename = str_replace("file/", "", $file->getFilename()); foreach ($sizes as $size => $description) { if ($size < 600) { $upscale = true; } else { $upscale = false; } $thumbnail = get_resized_image_from_existing_file($file->getFilenameOnFilestore(), $size, $size, $upscale); if ($thumbnail) { $path = "file/" . $description . "_" . $filename; $thumb = new ElggFile(); $thumb->setMimeType($_FILES['upload']['type']); $thumb->setFilename($path); $thumb->open("write"); $thumb->write($thumbnail); $thumb->close(); if ($description == "thumb") { $file->thumbnail = $path; } else { $file->{$description} = $path; } unset($thumbnail); } } }
public function __construct(ElggObject $video) { parent::__construct(); $this->setInputfile($video->getFilenameOnFilestore()); $this->fileinfo = $this->execute(); }