[9.1.12] free image map erreur

This commit is contained in:
fredtempez 2019-06-18 10:13:09 +02:00
parent 50026f9092
commit 59fde383f0
2 changed files with 26 additions and 18 deletions

View File

@ -32,7 +32,7 @@ class common {
const TEMP_DIR = 'site/tmp/';
// Numéro de version
const ZWII_VERSION = '9.1.11';
const ZWII_VERSION = '9.1.12';
public static $actions = [];
public static $coreModuleIds = [
@ -349,7 +349,8 @@ class common {
if (!file_exists(self::FILE_DIR.'source/screenshot.png'))
{
if ( strpos(helper::baseUrl(false),'localhost') == 0 AND strpos(helper::baseUrl(false),'127.0.0.1') == 0) {
$googlePagespeedData = file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. helper::baseUrl(false) .'&screenshot=true');
$googlePagespeedData = @file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. helper::baseUrl(false) .'&screenshot=true');
if ($googlePagespeedData !== false) {
$googlePagespeedData = json_decode($googlePagespeedData, true);
$screenshot = $googlePagespeedData['screenshot']['data'];
$screenshot = str_replace(array('_','-'),array('/','+'),$screenshot);
@ -359,6 +360,7 @@ class common {
}
}
}
}

View File

@ -231,19 +231,25 @@ class config extends common {
$site = 'https://zwiicms.com/'; } else {
$site = helper::baseUrl(false); }
$googlePagespeedData = file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. $site .'&screenshot=true');
$success= false;
$googlePagespeedData = @file_get_contents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. $site .'&screenshot=true');
if ($googlePagespeedData !== false) {
$googlePagespeedData = json_decode($googlePagespeedData, true);
$screenshot = $googlePagespeedData['screenshot']['data'];
$screenshot = str_replace(array('_','-'),array('/','+'),$screenshot);
$data = 'data:image/jpeg;base64,'.$screenshot;
$data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data));
// Effacer la miniature
unlink (self::FILE_DIR.'thumb/screenshot.png');
file_put_contents( self::FILE_DIR.'source/screenshot.png',$data);
$success =true;
}
// Valeurs en sortie
$this->addOutput([
'notification' => 'Image tag réinitialisée',
'notification' => $success === true ? 'Image tag réinitialisée' : "Erreur : image tag non créée",
'redirect' => helper::baseUrl() . 'config',
'state' => true
'state' => $success
]);
}