I try to specify the quality factor for Fatfree image processing. According to the documentation (https://fatfreeframework.com/image#dump) the dump method may take an integer value to specify the quality:
$img->dump($fileType, 75) // $filetype is 'jpeg'
but I get the following error:
imagejpeg(): Invalid 2nd parameter, it must [sic] a filename or a stream
[...base.php:2032] Base->error(500,'imagejpeg(): Invalid 2nd parameter, it must a filename or a stream')
[...index.php:712] Image->dump('jpeg', 75)
Passing the quality factor as a string instead of int gets rid of the message but the resulting image is then empty. (I know that jpeg and png dump use different values for quality/compression rate.)
Any idea where my error is? Thanks,
There was a contradiction between the docs and the library. The library was expecting an extra NULL
argument, exactly as for the native imagejpeg() function.
This has been fixed now in the framework, so you can download the edge version of the framework or wait for the next release.
As a summary:
F3 <= 3.5.1
$img->dump($fileType, NULL, 75)
F3 > 3.5.1
$img->dump($fileType, 75)