php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63920 imagejpeg
Submitted: 2013-01-06 17:04 UTC Modified: 2013-01-08 06:48 UTC
From: zebroid at list dot ru Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.4.10 OS: debian 6.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zebroid at list dot ru
New email:
PHP Version: OS:

 

 [2013-01-06 17:04 UTC] zebroid at list dot ru
Description:
------------
after update php 5.3->php 5.4 i have a problem with image thumbnails in vbulletin forum v 3.8.7 (last in the 3.x branch)

after some investigations i find the problem. code
imagejpeg($image, '', $quality);
works fine in php 5.3 and output jpeg image to browser

but in php 5.4 in only generate error:
Warning: imagejpeg(): Filename cannot be empty in [path]/includes/class_image.php on line 1428

i read a documentation http://php.net/manual/en/function.imagejpeg.php and understand that now it should works maybe in more 'pedantic' way (imagejpeg($image, NULL, $quality)), but maybe for the Backward Compatible you make this function work in a old way? (NULL or '' in secord parameter to output jpeg)

or, at least, mention about that on http://php.net/manual/en/migration54.incompatible.php
vBulletin v3.x still rather popular and suppose that not only i may face this problem

(and sorry for my russian-english)

Test script:
---------------
imagejpeg($image, '', $quality); <-work in php 5.3, dont work in php 5.4


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-07 06:16 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2013-01-07 06:16 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2013-01-07 17:09 UTC] zebroid at list dot ru
hm... well, it something like this

<?php

$jpeg_filename = "http://php.net/manual/en/images/21009b70229598c6a80eef8b45bf282b-imagecreatefromjpeg.jpg"; //or link to any local jpeg file
$jpeg_quality = 90;

$img = imagecreatefromjpeg($jpeg_filename);
header('Content-Type: image/jpeg');

//next line dont work in php 5.4, but work in php 5.3
imagejpeg($img, '', $jpeg_quality);

?>
 [2013-01-07 18:09 UTC] pajoye@php.net
the "" is the problem I suppose, use NULL if you don't want to save it but output 
it directly.
 [2013-01-08 06:42 UTC] zebroid at list dot ru
pajoye@php.net, can you read my first post at 2013-01-06 17:04 UTC?
 [2013-01-08 06:48 UTC] pajoye@php.net
-Status: Feedback +Status: Not a bug
 [2013-01-08 06:48 UTC] pajoye@php.net
We can't change that. It is part of the parameter parsing API. Simply use NULL 
which is actually what should have been used.
 [2015-06-10 17:01 UTC] gnikoloudis dot com at gmail dot com
Thanks for the feedback and resolution
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 25 07:01:31 2024 UTC