diff --git a/REVISION.md b/REVISION.md index 3784b2d..21edfa6 100644 --- a/REVISION.md +++ b/REVISION.md @@ -8,6 +8,9 @@ Revision history v0.7.6* (2015-10-20) ------------------------------------- +* Adding option &status to get an overview of the installed ond configured utilities. +* Bug, all files saved as png-files, when not saving as specific file. +* Removed saving filename extension for alias images. * Added option to decide if resample or resize when copying images internally. `&no-resample` makes resize, instead of resample as is default. * Verbose now correctly states if transparent color is detected. * Compare-tool now supports 6 images. diff --git a/webroot/img.php b/webroot/img.php index 3dba6f4..28623ac 100644 --- a/webroot/img.php +++ b/webroot/img.php @@ -157,6 +157,13 @@ verbose("img.php version = $version"); +/** +* status - do a verbose dump of the configuration +*/ +$status = getDefined('status', true, false); + + + /** * Set mode as strict, production or development. * Default is production environment. @@ -178,6 +185,7 @@ if ($mode == 'strict') { ini_set('display_errors', 0); ini_set('log_errors', 1); $verbose = false; + $status = false; $verboseFile = false; } elseif ($mode == 'production') { @@ -186,6 +194,7 @@ if ($mode == 'strict') { ini_set('display_errors', 0); ini_set('log_errors', 1); $verbose = false; + $status = false; $verboseFile = false; } elseif ($mode == 'development') { @@ -910,6 +919,75 @@ $cachePath = getConfig('cache_path', __DIR__ . '/../cache/'); +/** + * Prepare a dummy image and use it as source image. + */ +$dummyDir = getConfig('dummy_dir', $cachePath. "/" . $dummyFilename); + +if ($dummyImage === true) { + is_writable($dummyDir) + or verbose("dummy dir not writable = $dummyDir"); + + $img->setSaveFolder($dummyDir) + ->setSource($dummyFilename, $dummyDir) + ->setOptions( + array( + 'newWidth' => $newWidth, + 'newHeight' => $newHeight, + 'bgColor' => $bgColor, + ) + ) + ->setJpegQuality($quality) + ->setPngCompression($compress) + ->createDummyImage() + ->generateFilename(null, false) + ->save(null, null, false); + + $srcImage = $img->getTarget(); + $imagePath = null; + + verbose("src (updated) = $srcImage"); +} + + + +/** + * Display status + */ +if ($status) { + $text = "img.php version = $version\n"; + $text .= "PHP version = " . PHP_VERSION . "\n"; + $text .= "Running on: " . $_SERVER['SERVER_SOFTWARE'] . "\n"; + $text .= "Allow remote images = $allowRemote\n"; + $text .= "Cache writable = " . is_writable($cachePath) . "\n"; + $text .= "Cache dummy writable = " . is_writable($dummyDir) . "\n"; + $text .= "Alias path writable = " . is_writable($aliasPath) . "\n"; + + $no = extension_loaded('exif') ? null : 'NOT'; + $text .= "Extension exif is $no loaded.
"; + + $no = extension_loaded('curl') ? null : 'NOT'; + $text .= "Extension curl is $no loaded.
"; + + $no = extension_loaded('gd') ? null : 'NOT'; + $text .= "Extension gd is $no loaded.
"; + + if (!$no) { + $text .= print_r(gd_info(), 1); + } + + echo << + + +CImage status +
$text
+EOD; + exit; +} + + + /** * Display image if verbose mode */ @@ -937,7 +1015,7 @@ if ($verbose) { window.getDetails = function (url, id) { $.getJSON(url, function(data) { element = document.getElementById(id); - element.innerHTML = "filename: " + data.filename + "\\nmime type: " + data.mimeType + "\\ncolors: " + data.colors + "\\nsize: " + data.size + "\\nwidth: " + data.width + "\\nheigh: " + data.height + "\\naspect-ratio: " + data.aspectRatio + "\\npng-type: " + data.pngType; + element.innerHTML = "filename: " + data.filename + "\\nmime type: " + data.mimeType + "\\ncolors: " + data.colors + "\\nsize: " + data.size + "\\nwidth: " + data.width + "\\nheigh: " + data.height + "\\naspect-ratio: " + data.aspectRatio + ( data.pngType ? "\\npng-type: " + data.pngType : ''); }); } @@ -956,44 +1034,6 @@ if ($verboseFile) { -/** - * Set basic options for image processing. - */ - - -/** - * Prepare a dummy image and use it as source image. - */ -if ($dummyImage === true) { - - $dummyDir = getConfig('dummy_dir', $cachePath. "/" . $dummyFilename); - - is_writable($dummyDir) - or verbose("dummy dir not writable = $dummyDir"); - - $img->setSaveFolder($dummyDir) - ->setSource($dummyFilename, $dummyDir) - ->setOptions( - array( - 'newWidth' => $newWidth, - 'newHeight' => $newHeight, - 'bgColor' => $bgColor, - ) - ) - ->setJpegQuality($quality) - ->setPngCompression($compress) - ->createDummyImage() - ->generateFilename(null, false) - ->save(null, null, false); - - $srcImage = $img->getTarget(); - $imagePath = null; - - verbose("src (updated) = $srcImage"); -} - - - /** * Load, process and output the image */