Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imagejpeg(): Filename cannot be empty #1

Closed
peterhough opened this issue Sep 24, 2013 · 1 comment
Closed

imagejpeg(): Filename cannot be empty #1

peterhough opened this issue Sep 24, 2013 · 1 comment

Comments

@peterhough
Copy link
Contributor

Hi James,

Experimenting with phpThumb today I came across the following issue:

phpthumb.class.php line 607

@$ImageOutFunction($this->gdimg_output, '', $this->thumbnailQuality);

From the PHP manual: http://php.net/manual/en/function.imagejpeg.php
bool imagejpeg ( resource $image [, string $filename [, int $quality ]] )
filename: To skip this argument in order to provide the quality parameter, use NULL.

Therefore I suggest altering:
phpthumb.class.php line 607 to:

@$ImageOutFunction($this->gdimg_output, NULL, $this->thumbnailQuality);

Cheers!
Pete

@JamesHeinrich
Copy link
Owner

Thanks. The same issue also happened on line 2904.

Fixed in this commit:
736effc

Historical note: back when this code was written (~2003) the PHP manual said use empty string for skipping the second parameter. The recommendation changed from "" to NULL sometime between 2006-Sep-02 and 2006-Sep-25:
http://web.archive.org/web/20060902214907/http://www.php.net/manual/en/function.imagejpeg.php
http://web.archive.org/web/20060925172257/http://www.php.net/manual/en/function.imagejpeg.php

quentinwolf added a commit to quentinwolf/phpThumb that referenced this issue Jul 11, 2023
with PHP 8.2, Fixing Deprecated warning:  trim(): Passing null to parameter JamesHeinrich#1 ($string) of type string is deprecated in phpthumb.class.php on line 1495
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants