1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-18 12:31:17 +02:00

cleaning minor things and whitespaces

and added "Options Hierarchy" to the getDebugInfo method
This commit is contained in:
horst-n
2019-04-27 10:27:07 +02:00
parent 8da54040d4
commit ec2c2cf4e0

View File

@@ -186,7 +186,7 @@ class Pageimage extends Pagefile {
* @return string * @return string
* *
*/ */
public function urlWebp() { public function webpUrl() {
if(!$this->hasWebp()) { if(!$this->hasWebp()) {
return '#'; // @Ryan: what should be returned for none existing webp variations here? return '#'; // @Ryan: what should be returned for none existing webp variations here?
} }
@@ -426,11 +426,11 @@ class Pageimage extends Pagefile {
case 'hasWebp': case 'hasWebp':
$value = $this->hasWebp(); $value = $this->hasWebp();
break; break;
case 'urlWebp':
case 'srcWebp':
case 'webpUrl': case 'webpUrl':
case 'webpSrc': case 'webpSrc':
$value = $this->urlWebp(); case 'urlWebp':
case 'srcWebp':
$value = $this->webpUrl();
break; break;
default: default:
$value = parent::get($key); $value = parent::get($key);
@@ -1642,7 +1642,8 @@ class Pageimage extends Pagefile {
if($success) $deletedFiles[] = $filename; if($success) $deletedFiles[] = $filename;
// Also remove WebP variation, if there exist one // Also remove WebP variation, if there exist one
$webp = dirname($filename) . '/' . str_replace(array('.jpg', '.jpeg', '.png', '.gif'), '.webp', basename($filename)); $path_parts = pathinfo($filenameFinal);
$webp = dirname($filename) . '/' . $path_parts['filename'] . '.webp';
if(!is_file($webp)) continue; if(!is_file($webp)) continue;
if($options['dryRun']) { if($options['dryRun']) {
$success = true; $success = true;
@@ -1928,10 +1929,16 @@ class Pageimage extends Pagefile {
$info['neededEngineSupport'] = $is->getImageInfo(); $info['neededEngineSupport'] = $is->getImageInfo();
$info['installedEngines'] = array_merge($is->getEngines(), array('ImageSizerEngineGD')); $info['installedEngines'] = array_merge($is->getEngines(), array('ImageSizerEngineGD'));
$info['selectedEngine'] = $is->getEngine(); $info['selectedEngine'] = $is->getEngine();
$info['individualOptions'] = $options; $info['Options Hierarchy'] = array();
$info['Options Hierarchy']['imageSizerOptions'] = $this->wire('config')->imageSizerOptions;
$info['Options Hierarchy']['individualOptions'] = $options;
$info['Options Hierarchy']['finalOptions'] = $is->getOptions();
if(!$returnAsString) { if(!$returnAsString) {
return $info; return $info;
} }
// make a beautyfied var_dump
ob_start(); ob_start();
var_dump($info); var_dump($info);
$content = ob_get_contents(); $content = ob_get_contents();
@@ -1951,10 +1958,13 @@ class Pageimage extends Pagefile {
$content = preg_replace('#^((\s*).*){$#m', "\\1\n\\2{", $content); $content = preg_replace('#^((\s*).*){$#m', "\\1\n\\2{", $content);
$content = str_replace(array('<pre>', '</pre>'), '', $content); $content = str_replace(array('<pre>', '</pre>'), '', $content);
if(isset($_SERVER['HTTP_HOST'])) { if(isset($_SERVER['HTTP_HOST'])) {
$return = "<pre style=\"margin:10px 10px 10px; padding:10px 10px 10px 10px; background-color:#F2F2F2; color:#000; border:1px solid #333; font-family:'Hack', 'Source Code Pro', 'Lucida Console', 'Courier', monospace; font-size:12px; line-height:15px; overflow:scroll;\">{$content}</pre>"; // build output for HTML
$return = "<pre style=\"margin:10px 10px 10px; padding:10px 10px 10px 10px; background-color:#F2F2F2; color:#000; border:1px solid #333; font-family:'Hack', 'Source Code Pro', 'Lucida Console', 'Courier', monospace; font-size:12px; line-height:15px; overflow:auto;\">{$content}</pre>";
} else { } else {
// output for Console
$return = $content; $return = $content;
} }
return $return; return $return;
} }