10.1 Bug imagetag + majuscules
This commit is contained in:
parent
2553a659c5
commit
ca963adbbd
@ -255,21 +255,19 @@ class config extends common {
|
||||
$site = helper::baseUrl(false); }
|
||||
|
||||
$success= false;
|
||||
$googlePagespeedData = helper::urlGetContents('https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url='. $site .'&screenshot=true');
|
||||
$googlePagespeedData = helper::urlGetContents('https://www.googleapis.com/pagespeedonline/v5/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));
|
||||
$data = str_replace('_','/',$googlePagespeedData['lighthouseResult']['audits']['final-screenshot']['details']['data']);
|
||||
$data = str_replace('-','+',$data);
|
||||
$img = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data));
|
||||
// Effacer la miniature
|
||||
if (file_exists(self::FILE_DIR.'thumb/screenshot.png')) {
|
||||
unlink (self::FILE_DIR.'thumb/screenshot.png');
|
||||
if (file_exists(self::FILE_DIR.'thumb/screenshot.jpg')) {
|
||||
unlink (self::FILE_DIR.'thumb/screenshot.jpg');
|
||||
}
|
||||
file_put_contents( self::FILE_DIR.'source/screenshot.png',$data);
|
||||
file_put_contents( self::FILE_DIR.'source/screenshot.jpg',$img);
|
||||
$success =true;
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => $success === true ? 'Image tag réinitialisée' : 'Erreur : image tag non créée',
|
||||
|
@ -249,8 +249,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR.'source/screenshot.png';?>" data-tippy-content="Cette capture d'écran est nécessaire aux partages sur les réseaux sociaux. Elle est régénérée lorsque le fichier 'screenshot.png' est effacé du gestionnaire de fichiers." />
|
||||
<div class="col8 offset2 textAlignCenter">
|
||||
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR.'source/screenshot.jpg';?>" data-tippy-content="Cette capture d'écran est nécessaire aux partages sur les réseaux sociaux. Elle est régénérée lorsque le fichier 'screenshot.png' est effacé du gestionnaire de fichiers." />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('configManageSubmit',[
|
||||
'value' => 'valider',
|
||||
'value' => 'Valider',
|
||||
'ico' => 'check'
|
||||
]); ?>
|
||||
</div>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('configAdminSubmit',[
|
||||
'value' => 'valider',
|
||||
'value' => 'Valider',
|
||||
'ico' => 'check'
|
||||
]); ?>
|
||||
</div>
|
||||
|
BIN
site/file/source/screenshot.png
Executable file → Normal file
BIN
site/file/source/screenshot.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue
Block a user