2020-11-27
13:02 Closed ticket [8aff41aff6]: erreur lors de l'enregistrement de "Image de fond" plus 6 other changes artifact: d9a8bd3772 user: bohwaz
2020-11-22
14:25 New ticket [8aff41aff6]. artifact: 082926aae3 user: damientanche

Ticket Hash: 8aff41aff62f105b72499b3e39d9221f620dc23f
Title: erreur lors de l'enregistrement de "Image de fond"
Status: Closed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Resolution: Rejected
Last Modified: 2020-11-27 13:02:52
Version Found In: 1.0.0-beta6
User Comments:

damientanche added on 2020-11-22 13:25:26:

bonjour, 
je sélectionne l'image jpg ou png en format nb de moins 380x200 on voit l'apercu
et lorsque je fait enregistrer j'ai l'erreur suivante
-----------------------------

Une erreur s'est produite
RuntimeException
No suitable image library found for type: image/png
in .../include/lib/KD2/Graphics/Image.php:209

205			}
206
207			if (!$library)
208			{
209				throw new \RuntimeException('No suitable image library found for type: ' . $this->type);
210			}
211		}
212
213		$this->library = $library;

in .../include/lib/KD2/Graphics/Image.php:258
→ KD2\Graphics\Image->init (2 arg.)
$info	

array(6) {
  [0]=> int(343)
  [1]=> int(200)
  [2]=> int(3)
  [3]=> string(24) "width="343" height="200""
  ["bits"]=> int(8)
  ["mime"]=> string(9) "image/png"
}

$library	

NULL

254			throw new \RuntimeException('Invalid image format, couldn\'t be read: from string');
255		}
256
257		$obj->blob = $blob;
258		$obj->init($info, $library);
259
260		self::$init = false;
261
262		return $obj;

in .../include/lib/Garradin/Fichiers.php:571
→ KD2\Graphics\Image::createFromBlob (1 arg.)
$blob	

567				if ($path && !$content) {
568					$i = new Image($path);
569				}
570				else {
571					$i = Image::createFromBlob($content);
572				}
573
574				// Recompress PNG files from base64, assuming they are coming
575				// from JS canvas which doesn't know how to gzip (d'oh!)

in .../include/lib/Garradin/Fichiers.php:524
→ Garradin\Fichiers::storeFile (3 arg.)
$name	

string(14) "image_fond.png"

$path	

NULL

$content	

520	 */
521	static public function storeFromBase64($name, $content)
522	{
523		$content = base64_decode($content);
524		return self::storeFile($name, null, $content);
525	}
526
527	/**
528	 * Upload de fichier (interne)

in .../include/lib/Garradin/Config.php:141
→ Garradin\Fichiers::storeFromBase64 (2 arg.)
$name	

string(14) "image_fond.png"

$content	

137            }
138
139            if (strlen($value) > 0)
140            {
141                $f = Fichiers::storeFromBase64($key . '.png', $value);
142                $value = $f->id;
143                unset($f);
144            }
145        }

in .../www/admin/config/index.php:39
→ Garradin\Config->save (0 arg.)

35        if (trim(f('image_fond')) != '') {
36            $config->set('image_fond', f('image_fond') ?: null);
37        }
38
39        $config->save();
40
41        Utils::redirect(ADMIN_URL . 'config/?ok');
42    }
43    catch (UserException $e)

Context
id	bykqb332
date	2020-11-22T14:17:18+01:00
os	Linux
language	PHP 7.4.9
environment	development
php_sapi	cli-server
remote_ip	127.0.0.1
http_method	POST
files_sent	array(0) { }
rootDirectory	/usr/share/garradin
garradin_data_root	/home/leskeepcool/.local/share/garradin
garradin_version	1.0.0-beta6
url	http://127.0.0.1:8081/admin/config/

bohwaz added on 2020-11-27 12:02:52:

Hello,

comme l'erreur l'indique tu n'a pas de bibliothèque de gestion d'image installée, donc Garradin ne peut gérer les images.

Il te faut installer Imagick ou GD.

Je vais améliorer le message d'erreur.