? Success

User tests: Successful: Unsuccessful:

avatar bembelimen
bembelimen
22 Sep 2014

If you crop-resize an image and choose set the $createNew Parameter to true, the original image will be resized nevertheless.

The patch fixes this error.

Test:

  • Load an image with JImage
  • cropResize the Image with "$createNew" to "true".
  • Look at the old (orignal) JImage object with the orignal image. It should be resized to the new dimensions
  • Apply patch
  • Try again => The original image object should have preserved its dimensions
avatar bembelimen bembelimen - open - 22 Sep 2014
avatar jissues-bot jissues-bot - change - 22 Sep 2014
Labels Added: ?
avatar Hackwar Hackwar - test_item - 22 Sep 2014 - Tested successfully
avatar jacxx jacxx - test_item - 22 Sep 2014 - Tested successfully
avatar jacxx jacxx - test_item - 22 Sep 2014 - Tested successfully
avatar matrikular
matrikular - comment - 22 Sep 2014

@test - fixes the issue, nice find.

avatar brianteeman brianteeman - change - 22 Sep 2014
Category Libraries
avatar infograf768
infograf768 - comment - 23 Sep 2014

Any extension/code we could test with?

avatar bembelimen
bembelimen - comment - 23 Sep 2014

Hello,
you could test with something like that:

// Load a large image (at least 800x600 and a JPG)
$absolute_path_to_image = JPATH_BASE . '/images/my/image.jpg';
$baseimage = new JImage($absolute_path_to_image);

$sizes = array();
$sizes[] = '50x50';
$sizes[] = '600x450';

// Create images in a subfolder "thumbs"
$baseimage->createThumbs($sizes, JImage::CROP_RESIZE);

$new_absolute_path = JPATH_BASE . '/images/my/new_image.jpg';
$baseimage->toPath($new_absolute_path);

You have to replace $absolute_path_to_image and $new_absolute_path with your paths to the image and where the new image should be saved.

Expected results:

  • The new image ($new_absolute_path) should be unchanged to the original image ($absolute_path_to_image).
  • The thumbnails should be resized and cropped images of the original one

Actual result:

  • The second thumbnail based on the first, so it's fuzzy
  • The new original image is changed

=> Apply patch and try again

(You can test this with only the 50x50 size and then saving ->toFile(...) so see the error.)

avatar matrikular
matrikular - comment - 23 Sep 2014

I did something like this;

// Original image dimensions: 300 x 62
$image = new JImage(__DIR__ . '/logo.png');

echo 'Original image bevore cropResize:  Width: ' . $image->getWidth() . ' Height: ' . $image->getHeight();

// Output without patch: Original image before cropResize: Width: 300 Height: 62
// Output with patch: Original image before cropResize: Width: 300 Height: 62

$newImage = $image->cropResize(150, 31, true);

echo ' | Original image after cropResize:  Width: ' . $image->getWidth() . ' Height: ' . $image->getHeight();

// Output without patch: Original image after cropResize: Width: 150 Height: 31
// Output with patch: Original image after cropResize: Width: 300 Height: 62
avatar Kubik-Rubik Kubik-Rubik - test_item - 24 Sep 2014 - Tested successfully
avatar Kubik-Rubik Kubik-Rubik - change - 24 Sep 2014
Status Pending Ready to Commit
avatar Kubik-Rubik Kubik-Rubik - alter_testresult - 24 Sep 2014 - matrikular: Tested successfully
avatar Kubik-Rubik
Kubik-Rubik - comment - 24 Sep 2014

I can reproduce the bug and the patch fixes it!

We have 4 successful tests, moving to RTC.

Thank you for you contribution, @bembelimen!

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar infograf768
infograf768 - comment - 25 Sep 2014

Folks, when you move to RTC, make sure it is also set to RTC in github

avatar infograf768 infograf768 - close - 25 Sep 2014
avatar infograf768 infograf768 - reference | 05dc0b8 - 25 Sep 14
avatar infograf768 infograf768 - merge - 25 Sep 2014
avatar infograf768 infograf768 - close - 25 Sep 2014
avatar infograf768 infograf768 - change - 25 Sep 2014
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2014-09-25 13:44:07
avatar mbabker mbabker - change - 27 Sep 2014
Milestone Added:
avatar bembelimen bembelimen - head_ref_deleted - 20 Nov 2014

Add a Comment

Login with GitHub to post a comment