From 97e21151283eb3817e12c8161cbf702af1eb2b6c Mon Sep 17 00:00:00 2001 From: Steven Dodd Date: Sun, 10 Aug 2025 13:23:56 +0000 Subject: [PATCH] Added check for GD functions --- application/views/eqslcard/index.php | 53 +++++++++++++++------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/application/views/eqslcard/index.php b/application/views/eqslcard/index.php index 91db4632..ec940db6 100644 --- a/application/views/eqslcard/index.php +++ b/application/views/eqslcard/index.php @@ -122,35 +122,38 @@ - result())) { - foreach ($qslarray->result() as $qsl) { - $src = $folder_name.'/'.$qsl->image_file; - $dest = $folder_name.'/_'.$qsl->image_file; - if (file_exists($folder_name.'/_'.$qsl->image_file) == false) { - /* read the source image */ - $data = file_get_contents( $src ); - $source_image = imagecreatefromstring( $data ); - $width = imagesx( $source_image ); - $height = imagesy( $source_image ); +result())) { + foreach ($qslarray->result() as $qsl) { + $src = $folder_name.'/'.$qsl->image_file; + $dest = $folder_name.'/_'.$qsl->image_file; + if (file_exists($folder_name.'/_'.$qsl->image_file) == false) { + /* read the source image */ + $data = file_get_contents( $src ); + $source_image = imagecreatefromstring( $data ); + $width = imagesx( $source_image ); + $height = imagesy( $source_image ); - /* create a new, "virtual" image */ - $virtual_image = imagecreatetruecolor( $desired_width, $desired_height ); + /* find the "desired height" of this thumbnail, relative to the desired width */ + $desired_height = floor( $height * ( $desired_width / $width ) ); - /* copy source image at a resized size */ - imagecopyresampled( $virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height ); + /* create a new, "virtual" image */ + $virtual_image = imagecreatetruecolor( $desired_width, $desired_height ); - /* create the physical thumbnail image to its destination */ - imagejpeg( $virtual_image, $dest, 60 ); - } - echo ''; - } - } + /* copy source image at a resized size */ + imagecopyresampled( $virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height ); + + /* create the physical thumbnail image to its destination */ + imagejpeg( $virtual_image, $dest, 60 ); + } + echo ''; + } + } + } ?>