php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71423 Misrepresentation
Submitted: 2016-01-20 17:56 UTC Modified: 2016-01-21 06:40 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: xxalfa at gmail dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 7.0.2 OS: Mac OS X 10.11.2
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: xxalfa at gmail dot com
New email:
PHP Version: OS:

 

 [2016-01-20 17:56 UTC] xxalfa at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.imagescale
---
I would like to use this function, just do not do what I expect.

Test script:
---------------
$old_width = imagesx( $image_resource );
$old_height = imagesy( $image_resource );

$percent = 10;

$new_width = $width * $percent;
$new_height = $height * $percent;

// BLURRED
$new_image_resource = imagescale( $image_resource, $new_width, $new_height );

// THE IMAGE IS SHARP NOW, BUT HAS A BLACK BORDER ON THE LEFT AND BELOW.
$new_image_resource = imagescale( $image_resource, $new_width, $new_height, IMG_BILINEAR_FIXED | IMG_BICUBIC_FIXED );

// CREATES A CLEAN MAGNIFICATION.
$new_image_resource = imagecreatetruecolor( $new_width, $new_height );
imagecopyresized( $new_image_resource, $image_resource, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height );


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-20 18:48 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2016-01-20 18:48 UTC] requinix@php.net
> BLURRED
Then the default interpolation method (fixed-point bilinear) is not suitable for you. If you don't need control over interpolation then imagecopyresampled() is generally the best resizing method.

> THE IMAGE IS SHARP NOW, BUT HAS A BLACK BORDER ON THE LEFT AND BELOW.
The $mode is not a bitmask. IMG_BILINEAR_FIXED | IMG_BICUBIC_FIXED => 3 | 5 => 7 which corresponds to the (undocumented) "box" method. Use one constant or the other, not both.
 [2016-01-21 05:04 UTC] xxalfa at gmail dot com
-Type: Bug +Type: Documentation Problem
 [2016-01-21 05:04 UTC] xxalfa at gmail dot com
The other function (imagecopyresampled), then I'll probably have to use unfortunately.

That an interpolation algorithm is used, it is now clear to me, only in what scenarios is something used?
 [2016-01-21 06:40 UTC] requinix@php.net
I don't really know. But https://en.wikipedia.org/wiki/Image_scaling looks interesting.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 12:01:32 2024 UTC