php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65171 imagescale() fails
Submitted: 2013-07-01 07:50 UTC Modified: 2014-10-15 16:50 UTC
Votes:6
Avg. Score:3.8 ± 1.5
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (25.0%)
From: susisoy at 163 dot com Assigned: remi (profile)
Status: Closed Package: GD related
PHP Version: 5.5.0 OS: CentOS 6.4
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: susisoy at 163 dot com
New email:
PHP Version: OS:

 

 [2013-07-01 07:50 UTC] susisoy at 163 dot com
Description:
------------
imagescale() function cannot be used.

Test script:
---------------
<?php
$im = imagecreatefrompng('1.png');
$im2 = imagescale($im, 100);
imagepng($im2);

Expected result:
----------------
Warning: imagescale(): gd warning: one parameter to a memory allocation 
multiplication is negative or zero, failing operation gracefully in 
/mnt/hgfs/F/Test/index.php on line 3

Warning: imagepng() expects parameter 1 to be resource, boolean given in 
/mnt/hgfs/F/Test/index.php on line 4

Actual result:
--------------
...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-02 18:46 UTC] aharvey@php.net
-Summary: PHP 5.5.0 +Summary: imagescale() fails -PHP Version: master-Git-2013-07-01 (Git) +PHP Version: 5.5.0
 [2013-12-31 16:04 UTC] matteosistisette at gmail dot com
It looks like this function is just some kind of draft (there's a warning in the documentation saying it's not documented), recently introduced.

If it's not intended to be used and it's still not functional, it should either be made invisible until it's usable, or an alternative should be mentioned in the documentation.

Having to find out that it's completely broken by using it after finding it in the documentation is terribly annoying.
 [2014-10-15 16:50 UTC] remi@php.net
-Assigned To: +Assigned To: remi
 [2014-10-15 16:50 UTC] remi@php.net
Despite document says third arg (height) is optional, it is, for now, mandatory.
 [2014-10-15 16:58 UTC] richard at sublogic dot se
After talking with RemiFedora at #libgd on IRC at irc.freenode.net I got the following workaround: Specify an explicit height for imagescale().

My system which showed the problem:
Archlinux
PHP Version 5.6.1

array (size=12)
  'GD Version' => string '2.1.0-alpha' (length=11)
  'FreeType Support' => boolean true
  'FreeType Linkage' => string 'with freetype' (length=13)
  'T1Lib Support' => boolean false
  'GIF Read Support' => boolean true
  'GIF Create Support' => boolean true
  'JPEG Support' => boolean true
  'PNG Support' => boolean true
  'WBMP Support' => boolean true
  'XPM Support' => boolean true
  'XBM Support' => boolean true
  'JIS-mapped Japanese Font Support' => boolean false
 [2014-10-15 17:19 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2728e6f01798b1146b41587d38bf84cdf9988d17
Log: Fixed Bug #65171 imagescale() fails
 [2014-10-15 17:19 UTC] remi@php.net
-Status: Assigned +Status: Closed
 [2014-10-15 17:43 UTC] tyrael@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2728e6f01798b1146b41587d38bf84cdf9988d17
Log: Fixed Bug #65171 imagescale() fails
 [2014-10-15 17:43 UTC] tyrael@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2728e6f01798b1146b41587d38bf84cdf9988d17
Log: Fixed Bug #65171 imagescale() fails
 [2014-10-16 11:58 UTC] ab@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2728e6f01798b1146b41587d38bf84cdf9988d17
Log: Fixed Bug #65171 imagescale() fails
 [2014-11-07 10:16 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=335164
Log: Note the fix for bug #65171, and generally flesh out the imagescale() docs.

Fixes doc bug #68239 (Incorrect documentation or library bug).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 16:01:33 2024 UTC