(2016-08-03, 01:25:37)orrollo Wrote: hi, have some issue (GS 3.3.10 + 1.24):
has one multi-image field. adding image, ok, but: no image thumbnail at the editor, look at the linked image. if i change path to image to relative (without http://sitename/) thumbnails are shown, but picture not saved due to errors in field.
image also at http://imgur.com/a/cqG4P
also, was fixed the code. changed SPEValidator.php:
Code:
public static function findImagePath($url){
global $GSADMIN;
$dataDirPart = str_replace(GSROOTPATH, '', GSDATAPATH); // "data/"
$pluginsDirPart = str_replace(GSROOTPATH, '', GSPLUGINPATH); // "plugins/"
$pluginsDirPart = str_replace(GSROOTPATH, '', GSPLUGINPATH); // "plugins/"
$port = ($p = $_SERVER['SERVER_PORT'])!='80' && $p !='443' ? ':'.$p : '';
$host = $_SERVER['SERVER_NAME'] . $port;
$pathParts = pathinfo($_SERVER['PHP_SELF']);
if ($pathParts['filename'] == 'changedata') //while saving page or while validating by ajax
$subDir = substr($pathParts['dirname'], 0, strrpos($pathParts['dirname'], $GSADMIN)); //find page subdir
else
$subDir = substr($pathParts['dirname'], 0, strpos($pathParts['dirname'], $pluginsDirPart.'SpecialPagesExtras')); //find page subdir
$siteHost = http_protocol()."://". $host;
//delete site host and subdir and data from image url
if ( substr($url, 0, strlen($siteHost.$subDir.$dataDirPart) ) == $siteHost.$subDir.$dataDirPart) {
$path = substr($url, strlen($siteHost.$subDir.$dataDirPart));
}
else if (substr($url, 0, strlen($subDir.$dataDirPart) ) == $subDir.$dataDirPart){ //if its root relative (ex. /data/uploads/image.jpg)
$path = substr($url, strlen($subDir.$dataDirPart));
}
else{ //wrong path, not full and root relative
return false;
}
$file = basename($path);
$subDir = tsl(dirname($path));
return array('dir' => $subDir, 'filename' => $file, 'full' => GSDATAPATH.$path);
}