Reputation: 48505
I use imagejpeg()
to save a resized image to a file, The file name can contain non latin characters, The issue is that it messes up the file name with some weird characters.
Any idea how to fix this? If not how to return the content of imagejpeg()
instead of saving it or printing it so i can use fwrite()
instead?
P.S. The same thing happens with imagepng()
and imagegif()
too.
Upvotes: 2
Views: 198
Reputation: 91744
Although I would recommend not using non-latin characters in filenames, you can use output buffering to capture the output of imagejpeg
and store it in a variable. If fwrite
does accept your filename, you can use it to write your variable to a file.
Something like:
ob_start();
imagejpeg($your_image);
$your_image_variable = ob_get_contents();
ob_end_clean();
Upvotes: 1