Skip to content
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
5 changes: 4 additions & 1 deletion adaptive-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ function generateImage($source_file, $cache_file, $resolution) {
imagefilledrectangle($dst, 0, 0, $new_width, $new_height, $transparent);
}

// invert the image to prevent atrifacts on white areas
imagefilter($src, IMG_FILTER_NEGATE);
ImageCopyResampled($dst, $src, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // do the resize in memory
imagefilter($dst, IMG_FILTER_NEGATE);
ImageDestroy($src);

// sharpen the image?
Expand Down Expand Up @@ -319,4 +322,4 @@ function generateImage($source_file, $cache_file, $resolution) {

/* It exists as a source file, and it doesn't exist cached - lets make one: */
$file = generateImage($source_file, $cache_file, $resolution);
sendImage($file, $browser_cache);
sendImage($file, $browser_cache);