Skip to content

Commit

Permalink
Merge pull request #1712 from tomudding/fix/image-cropping-due-to-inc…
Browse files Browse the repository at this point in the history
…orrect-cast

Fix cropping of `OrganInformation` images
  • Loading branch information
tomudding authored Sep 18, 2023
2 parents e98ce32 + 4f6774a commit 5aaece8
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions module/Decision/src/Service/Organ.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
use function array_filter;
use function array_merge;
use function count;
use function floatval;
use function getimagesize;
use function getrandmax;
use function in_array;
use function intval;
use function random_int;
use function round;
use function sys_get_temp_dir;
Expand Down Expand Up @@ -195,10 +195,10 @@ public function updateOrganInformation(
if ($data['cover']['size'] > 0) {
$coverPath = $this->makeOrganInformationImage(
$data['cover']['tmp_name'],
intval($data['coverCropX']),
intval($data['coverCropY']),
intval($data['coverCropWidth']),
intval($data['coverCropHeight']),
floatval($data['coverCropX']),
floatval($data['coverCropY']),
floatval($data['coverCropWidth']),
floatval($data['coverCropHeight']),
$config['cover_width'],
$config['cover_height'],
);
Expand All @@ -209,10 +209,10 @@ public function updateOrganInformation(
if ($data['thumbnail']['size'] > 0) {
$thumbnailPath = $this->makeOrganInformationImage(
$data['thumbnail']['tmp_name'],
intval($data['thumbnailCropX']),
intval($data['thumbnailCropY']),
intval($data['thumbnailCropWidth']),
intval($data['thumbnailCropHeight']),
floatval($data['thumbnailCropX']),
floatval($data['thumbnailCropY']),
floatval($data['thumbnailCropWidth']),
floatval($data['thumbnailCropHeight']),
$config['thumbnail_width'],
$config['thumbnail_height'],
);
Expand Down Expand Up @@ -240,10 +240,10 @@ public function updateOrganInformation(
* Create a thumbnail of the given file at the given location and scale.
*
* @param string $file The file to create the thumbnail of
* @param int $x The start x position in the image
* @param int $y The start y position in the image
* @param int $width The width of the area to crop
* @param int $height The height of the are to crop
* @param float $x The start x position in the image
* @param float $y The start y position in the image
* @param float $width The width of the area to crop
* @param float $height The height of the are to crop
* @param int $thumbWidth The width of the final thumbnail
* @param int $thumbHeight The height of the final thumbnail
*
Expand All @@ -253,10 +253,10 @@ public function updateOrganInformation(
*/
public function makeOrganInformationImage(
string $file,
int $x,
int $y,
int $width,
int $height,
float $x,
float $y,
float $width,
float $height,
int $thumbWidth,
int $thumbHeight,
): string {
Expand Down

0 comments on commit 5aaece8

Please sign in to comment.