Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For debug testing you can write the dimensions of the new image into the... #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions adaptive-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------------
Expand Down Expand Up @@ -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?
Expand Down