From e184a7ea165fe2c2b4e7640dd3e12c6126760302 Mon Sep 17 00:00:00 2001 From: 7samurai Date: Thu, 22 Mar 2012 11:02:22 +0100 Subject: [PATCH] For debug testing you can write the dimensions of the new image into the generated image. --- adaptive-images.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/adaptive-images.php b/adaptive-images.php index d2acd17..d7874fd 100644 --- a/adaptive-images.php +++ b/adaptive-images.php @@ -18,6 +18,7 @@ $sharpen = TRUE; // Shrinking images can blur details, perform a sharpen on re-scaled images? $watch_cache = TRUE; // check that the responsive image isn't stale (ensures updated source images are re-cached) $browser_cache = 60*60*24*7; // How long the BROWSER cache should last (seconds, minutes, hours, days. 7days by default) +$debug_mode = TRUE; // Write new Image dimentions into the stored image /* END CONFIG ---------------------------------------------------------------------------------------------------------- ------------------------ Don't edit anything after this line unless you know what you're doing ------------------------- @@ -148,6 +149,12 @@ function generateImage($source_file, $cache_file, $resolution) { imagefilledrectangle($dst, 0, 0, $new_width, $new_height, $transparent); } ImageCopyResampled($dst, $src, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // do the resize in memory + if($debug_mode){ + // write a textstring with the dimensions + $color = imagecolorallocate($dst, 249, 4, 4); // ugly red + imagestring( $dst, 5, 5, 5, $new_width." / ".$new_height,$color); + } + ImageDestroy($src); // sharpen the image?