You used resizeAndSaveToFile() wrongly, from source code, the arguments are: (v2022)
/**
* Resize and save uploaded data to file
*
* @param int $width Target width of image
* @param int $height Target height of image
* @param int $quality Deprecated, kept for backward compatibility only.
* @param string $newFileName New file name
* @param bool $overWrite Overwrite existing file or not
* @param int $idx optional Index of the file
* @return HttpUpload
*/
public function resizeAndSaveToFile($width, $height, $quality, $newFileName, $overWrite, $idx = -1)
I want to use PHPthumb for the thumb creation, but I don’t now how.So I can use adaptiveResize.
But now I only been able to make a thumb normal resize with resizeandsavetofile.Or use PHPthumb but than I can only resize the source file not make an extra file (thumb)
Note that after resizing, the image of the PHPthumb will be updated (smaller), so if you need another image which is larger, you should create the larger one first. For example, if want two images one is 100x100, the another 175x175, you should set the resize dimensions in Edit Tag as 100x100 and make the larger one (175x175) first in server event, e.g.
$this->MyField->Upload->Plugins[] = function($thumb) {
$thumb->adaptiveResize(175, 175)->save("my/path/myfile.ext"); // If you need to check the format to determine the extension name, you may check $thumb->format which should return 'GIF' or 'JPG' or 'PNG'.
};
Then the normal execution of script will continue to resize the image to 100x100.