mirror of
https://github.com/processwire/processwire.git
synced 2025-08-28 00:50:12 +02:00
Additional update for processwire/processwire-issues#575
This commit is contained in:
@@ -1298,6 +1298,7 @@ class Pageimage extends Pagefile {
|
|||||||
static $level = 0;
|
static $level = 0;
|
||||||
$variationName = basename($basename);
|
$variationName = basename($basename);
|
||||||
$originalName = $this->basename;
|
$originalName = $this->basename;
|
||||||
|
$info = array();
|
||||||
|
|
||||||
// that that everything from the beginning up to the first period is exactly the same
|
// that that everything from the beginning up to the first period is exactly the same
|
||||||
// otherwise, they are different source files
|
// otherwise, they are different source files
|
||||||
@@ -1320,9 +1321,6 @@ class Pageimage extends Pagefile {
|
|||||||
// if file doesn't start with the original name then it's not a variation
|
// if file doesn't start with the original name then it's not a variation
|
||||||
if(strpos($variationName, $originalName) !== 0) return false;
|
if(strpos($variationName, $originalName) !== 0) return false;
|
||||||
|
|
||||||
// if not in verbose mode, just return variation file name
|
|
||||||
if(!$options['verbose']) return $variationName;
|
|
||||||
|
|
||||||
// get down to the meat and the base
|
// get down to the meat and the base
|
||||||
// meat is the part of the filename containing variation info like dimensions, crop, suffix, etc.
|
// meat is the part of the filename containing variation info like dimensions, crop, suffix, etc.
|
||||||
// base is the part before that, which may include parent meat
|
// base is the part before that, which may include parent meat
|
||||||
@@ -1341,16 +1339,14 @@ class Pageimage extends Pagefile {
|
|||||||
|
|
||||||
// identify parent and any parent suffixes
|
// identify parent and any parent suffixes
|
||||||
$suffixAll = array();
|
$suffixAll = array();
|
||||||
while(($pos = strrpos($base, '.')) !== false) {
|
if($options['verbose']) {
|
||||||
$part = substr($base, $pos+1);
|
while(($pos = strrpos($base, '.')) !== false) {
|
||||||
// if(is_null($parent)) {
|
$part = substr($base, $pos + 1);
|
||||||
// $parent = substr($base, 0, $pos) . $ext;
|
$base = substr($base, 0, $pos);
|
||||||
//$parent = $originalName . "." . $part . $ext;
|
while(($rpos = strrpos($part, '-')) !== false) {
|
||||||
// }
|
$suffixAll[] = substr($part, $rpos + 1);
|
||||||
$base = substr($base, 0, $pos);
|
$part = substr($part, 0, $rpos);
|
||||||
while(($rpos = strrpos($part, '-')) !== false) {
|
}
|
||||||
$suffixAll[] = substr($part, $rpos+1);
|
|
||||||
$part = substr($part, 0, $rpos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1375,7 +1371,7 @@ class Pageimage extends Pagefile {
|
|||||||
// if regex does not match, return false
|
// if regex does not match, return false
|
||||||
if(preg_match($re1, $meat, $matches)) {
|
if(preg_match($re1, $meat, $matches)) {
|
||||||
// this is a variation with dimensions, return array of info
|
// this is a variation with dimensions, return array of info
|
||||||
$info = array(
|
if($options['verbose']) $info = array(
|
||||||
'name' => $basename,
|
'name' => $basename,
|
||||||
'url' => $this->pagefiles->url . $basename,
|
'url' => $this->pagefiles->url . $basename,
|
||||||
'path' => $this->pagefiles->path . $basename,
|
'path' => $this->pagefiles->path . $basename,
|
||||||
@@ -1389,7 +1385,7 @@ class Pageimage extends Pagefile {
|
|||||||
} else if(preg_match($re2, $meat, $matches)) {
|
} else if(preg_match($re2, $meat, $matches)) {
|
||||||
|
|
||||||
// this is a variation only with suffix
|
// this is a variation only with suffix
|
||||||
$info = array(
|
if($options['verbose']) $info = array(
|
||||||
'name' => $basename,
|
'name' => $basename,
|
||||||
'url' => $this->pagefiles->url . $basename,
|
'url' => $this->pagefiles->url . $basename,
|
||||||
'path' => $this->pagefiles->path . $basename,
|
'path' => $this->pagefiles->path . $basename,
|
||||||
@@ -1403,6 +1399,9 @@ class Pageimage extends Pagefile {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if not in verbose mode, just return variation basename
|
||||||
|
if(!$options['verbose']) return $variationName;
|
||||||
|
|
||||||
$actualInfo = $this->getImageInfo($info['path']);
|
$actualInfo = $this->getImageInfo($info['path']);
|
||||||
$info['actualWidth'] = $actualInfo['width'];
|
$info['actualWidth'] = $actualInfo['width'];
|
||||||
|
Reference in New Issue
Block a user