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 '';
+ }
+ }
+ }
?>