/** * make thumbnail and resize big image storing them in $dirname (and $dirname/thumb) as $filename * * @param string * @param HttpUploadedFile * @param int * @param int * @param int * @param int * @param bool makeThumbnail for big image or just resize proportionally? * @return void * @throws NotImageException */ public static function savePreviewWithThumb($dirname, $file, $thumb_w, $thumb_h, $big_w, $big_h, $useThumbForBig = false, $filename = 'main.jpg') { // return if no file given [may occur only when editing item otherwise it's controlled when submitting form] if (!$file instanceof HttpUploadedFile or empty($file->name)) { return; } if (!$file->isImage()) { throw new NotImageException('Nahrať možete iba obrázky! Poslaný súbor: ' . $file->name); } $img = $file->toImage(); parent::savePreviewWithThumb($img, $dirname, $thumb_w, $thumb_h, $big_w, $big_h, $useThumbForBig, $filename); }