Page MenuHomeIn-Portal Phabricator

INP-1773 Use "round" function during image resize instead of "ceil"
ClosedPublic

Authored by erik on Jun 26 2019, 6:20 AM.

Details

Summary

fixed image resize logic

Test Plan

Preparations

In the index.php, after $application->Init();, place following code:

$image_helper = $application->recallObject('ImageHelper');
echo '<img src="' . $image_helper->ResizeImage(FULL_PATH . IMAGES_PATH . '904x791.png', 120, 120) . '"/>';
echo '<img src="' . $image_helper->ResizeImage(FULL_PATH . IMAGES_PATH . '904x792.png', 120, 120) . '"/>';

Testing

  1. place attached files 904x791.png, and 904x792.png to the /system/images folder
  2. open website's Front-End
  3. confirm that both 904x791.png and 904x792.png images are displayed and resized to 120x105

Diff Detail

Repository
rINP In-Portal
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

erik created this revision.Jun 26 2019, 6:20 AM
erik requested review of this revision.Jun 26 2019, 6:20 AM
erik added a comment.Jun 26 2019, 6:22 AM
This comment was removed by erik.
erik edited the test plan for this revision. (Show Details)Jun 26 2019, 6:25 AM
alex added a project: Restricted Project.Jun 26 2019, 8:46 AM
alex edited the test plan for this revision. (Show Details)Jun 26 2019, 8:52 AM
alex requested changes to this revision.Jun 27 2019, 4:43 AM

Opening Front-End gives me these PHP warnings:

Warning (#1): rename(.../tmp/uploaded_xPjaG1.jpg,.../system/images/904x791.png): No such file or directory in ...\core\units\helpers\upload_helper.php on line 135
Warning (#2): rename(.../tmp/uploaded_zXuFcJ.jpg,.../system/images/904x792.png): No such file or directory in ...\core\units\helpers\upload_helper.php on line 135

I guess this happens, because D371 isn't applied. Anyway please rewrite test plan to use \ImageHelper::ResizeImage method directly and then verify images from URLs, that mentioned method will return.

This revision now requires changes to proceed.Jun 27 2019, 4:43 AM
erik requested review of this revision.Jun 27 2019, 5:38 AM
erik edited the test plan for this revision. (Show Details)

Changed test plan to use image helper.

alex accepted this revision.Jun 27 2019, 6:20 AM
This revision is now accepted and ready to land.Jun 27 2019, 6:20 AM
This revision was automatically updated to reflect the committed changes.