From 2ec1861dfb55979f2e2b87318ed44647bcbd90cd Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 25 Dec 2025 17:19:38 +0000 Subject: [PATCH 1/3] Show Thumbnails for images at eQSL-View --- application/views/eqslcard/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/eqslcard/index.php b/application/views/eqslcard/index.php index 581bf07a5..3f467e101 100644 --- a/application/views/eqslcard/index.php +++ b/application/views/eqslcard/index.php @@ -22,7 +22,7 @@ } if (is_array($qslarray->result())) { - echo ' + echo '
@@ -61,7 +61,7 @@ echo ''; - echo ''; + echo ''; echo ''; } From 19658f054d18b607846e6a6a8993c5c0bb424121 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 25 Dec 2025 17:20:41 +0000 Subject: [PATCH 2/3] Restore table-css --- application/views/eqslcard/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/eqslcard/index.php b/application/views/eqslcard/index.php index 3f467e101..47c99db1e 100644 --- a/application/views/eqslcard/index.php +++ b/application/views/eqslcard/index.php @@ -22,7 +22,7 @@ } if (is_array($qslarray->result())) { - echo '
'.__("Callsign").''; if ($qsl->COL_EQSL_QSLRDATE) { $timestamp = strtotime($qsl->COL_EQSL_QSLRDATE); echo date($custom_date_format, $timestamp); } echo 'COL_PRIMARY_KEY).'\' data-fancybox=\'images\' data-width=\'528\' data-height=\'336\' class=\'btn btn-sm btn-success\'>' . __("View") . 'COL_PRIMARY_KEY).'\' data-fancybox=\'images\' data-width=\'528\' data-height=\'336\' class=\'btn btn-sm btn-success\'>' . __("View") . 'COL_PRIMARY_KEY).'\' height="100px">
+ echo '
From 7027840e8aa0b36fc19d4fe0124e6fef916fd639 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 25 Dec 2025 17:58:30 +0000 Subject: [PATCH 3/3] Scale on serverside --- application/controllers/Eqsl.php | 59 ++++++++++++++++--- application/views/eqslcard/index.php | 6 +- application/views/interface_assets/footer.php | 2 +- 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 4b004a054..9d59d5dc9 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -293,7 +293,7 @@ class eqsl extends CI_Controller { return $table; } - function image($id) { + function image($id, $width=null) { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); @@ -396,9 +396,6 @@ class eqsl extends CI_Controller { return; } - header('Content-Type: image/jpg'); - echo $content; - $filename = uniqid() . '.jpg'; $image_path = $this->Eqsl_images->get_imagePath('p') . '/' . $filename; $save_result = file_put_contents($image_path, $content); @@ -409,15 +406,63 @@ class eqsl extends CI_Controller { log_message('error', 'Failed to save eQSL image to: ' . $image_path); } + $this->output_image_with_width($content, $width); return; // Only process the first image found } } else { - header('Content-Type: image/jpg'); - $image_url = base_url($this->Eqsl_images->get_imagePath() . '/' . $this->Eqsl_images->get_image($id)); - header('Location: ' . $image_url); + // Load cached image + $image_file = $this->Eqsl_images->get_imagePath('p') . '/' . $this->Eqsl_images->get_image($id); + $content = file_get_contents($image_file); + if ($content !== false) { + $this->output_image_with_width($content, $width); + } else { + show_error(__('Failed to load cached eQSL image'), 500); + } } } + /** + * Output image with optional width-based thumbnail generation + * @param string $image_data Binary image data + * @param int $width Desired width (null for original size) + */ + private function output_image_with_width($image_data, $width) { + header('Content-Type: image/jpg'); + + // If width is null or 0, output original image + if ($width!=(int)$width || $width === null || $width <= 0 || $width>1500) { // Return original Image if huger 1500 or smaller 100 or crap + echo $image_data; + return; + } + + // Generate thumbnail + $original_image = imagecreatefromstring($image_data); + if ($original_image === false) { + // Failed to process, output original + echo $image_data; + return; + } + + $original_width = imagesx($original_image); + $original_height = imagesy($original_image); + + // Calculate proportional height + $height = (int) (($original_height / $original_width) * $width); + + // Create new image + $thumbnail = imagecreatetruecolor($width, $height); + + // Resample + imagecopyresampled($thumbnail, $original_image, 0, 0, 0, 0, $width, $height, $original_width, $original_height); + + // Output + imagejpeg($thumbnail, null, 90); // 90% quality + + // Clean up + imagedestroy($original_image); + imagedestroy($thumbnail); + } + function bulk_download_image($id) { $this->load->model('user_model'); if (!$this->user_model->authorize(2)) { diff --git a/application/views/eqslcard/index.php b/application/views/eqslcard/index.php index 47c99db1e..ddbf21ba8 100644 --- a/application/views/eqslcard/index.php +++ b/application/views/eqslcard/index.php @@ -1,4 +1,4 @@ -
+

@@ -22,7 +22,7 @@ } if (is_array($qslarray->result())) { - echo '
'.__("Callsign").'
+ echo '
@@ -61,7 +61,7 @@ echo ''; - echo ''; + echo ''; echo ''; } diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index b3406eebc..0ced84025 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2447,7 +2447,7 @@ $('#sats').change(function(){ "scrollY": "500px", "scrollCollapse": true, "paging": false, - "scrollX": true, + "scrollX": false, "language": { url: getDataTablesLanguageUrl(), },
'.__("Callsign").''; if ($qsl->COL_EQSL_QSLRDATE) { $timestamp = strtotime($qsl->COL_EQSL_QSLRDATE); echo date($custom_date_format, $timestamp); } echo 'COL_PRIMARY_KEY).'\' data-fancybox=\'images\' data-width=\'528\' data-height=\'336\' class=\'btn btn-sm btn-success\'>' . __("View") . 'COL_PRIMARY_KEY).'\' height="100px">COL_PRIMARY_KEY).'\' data-fancybox=\'images\' data-width=\'528\' data-height=\'336\' class=\'btn btn-sm btn-success\'>' . __("View") . 'COL_PRIMARY_KEY).'/160\' height="100px">