@@ -31,6 +31,7 @@ class MiniatureObject extends RessourceObject implements RessourceInterface
3131{
3232 private int $ idImage ;
3333 private bool $ isPreview = false ;
34+ private string $ versionImagick ;
3435
3536 /**
3637 * Constructeur
@@ -77,6 +78,7 @@ public function charger(string $value, string $fromField = RessourceObject::SEAR
7778 $ this ->setNomNouveau ($ resultat ->new_name );
7879 $ this ->setIdImage ($ resultat ->images_id );
7980 $ this ->setIsPreview ($ resultat ->is_preview );
81+ $ this ->setVersionImagick ($ resultat ->version_imagick );
8082
8183 // Reprise des informations de l'image maitresse
8284 $ imageParente = new ImageObject ();
@@ -102,7 +104,7 @@ public function charger(string $value, string $fromField = RessourceObject::SEAR
102104 public function sauver (): void
103105 {
104106 // J'enregistre les infos en BDD
105- $ req = MaBDD::getInstance ()->prepare ('UPDATE thumbnails SET images_id = :imagesId, is_preview = :isPreview, date_action = :dateCreation, new_name = :newName, size = :size, height = :height, width = :width, last_view = :lastView, nb_view_v4 = :nbViewV4, nb_view_v6 = :nbViewV6, md5 = :md5 WHERE id = :id ' );
107+ $ req = MaBDD::getInstance ()->prepare ('UPDATE thumbnails SET images_id = :imagesId, is_preview = :isPreview, date_action = :dateCreation, new_name = :newName, size = :size, height = :height, width = :width, last_view = :lastView, nb_view_v4 = :nbViewV4, nb_view_v6 = :nbViewV6, md5 = :md5, version_imagick = :version_imagick WHERE id = :id ' );
106108
107109 $ req ->bindValue (':imagesId ' , $ this ->getIdImage (), PDO ::PARAM_INT );
108110 $ req ->bindValue (':isPreview ' , $ this ->getIsPreview (), PDO ::PARAM_INT );
@@ -116,6 +118,7 @@ public function sauver(): void
116118 $ req ->bindValue (':nbViewV6 ' , $ this ->getNbViewIPv6 (), PDO ::PARAM_INT );
117119 $ req ->bindValue (':md5 ' , $ this ->getMd5 ());
118120 $ req ->bindValue (':id ' , $ this ->getId (), PDO ::PARAM_INT );
121+ $ req ->bindValue (':version_imagick ' , $ this ->getVersionImagick ());
119122
120123 $ req ->execute ();
121124 }
@@ -184,18 +187,21 @@ public function creer(): bool
184187 $ this ->setHauteur ($ imageInfo [1 ]);
185188 // Poids
186189 $ this ->setPoids (filesize ($ this ->getPathMd5 ()));
190+ // Version d'Imagick
191+ $ this ->setVersionImagick (HelperSysteme::getImagickVersion ());
187192
188193 /**
189194 * Création en BDD
190195 */
191- $ req = MaBDD::getInstance ()->prepare ('INSERT INTO thumbnails (images_id, date_action, new_name, size, height, width, md5) VALUES (:imagesId, NOW(), :newName, :size, :height, :width, :md5) ' );
196+ $ req = MaBDD::getInstance ()->prepare ('INSERT INTO thumbnails (images_id, date_action, new_name, size, height, width, md5, version_imagick ) VALUES (:imagesId, NOW(), :newName, :size, :height, :width, :md5, :version_imagick ) ' );
192197 $ req ->bindValue (':imagesId ' , $ this ->getIdImage (), PDO ::PARAM_INT );
193198 // Date : NOW()
194199 $ req ->bindValue (':newName ' , $ this ->getNomNouveau ());
195200 $ req ->bindValue (':size ' , $ this ->getPoids (), PDO ::PARAM_INT );
196201 $ req ->bindValue (':height ' , $ this ->getHauteur (), PDO ::PARAM_INT );
197202 $ req ->bindValue (':width ' , $ this ->getLargeur (), PDO ::PARAM_INT );
198203 $ req ->bindValue (':md5 ' , $ this ->getMd5 ());
204+ $ req ->bindValue (':version_imagick ' , $ this ->getVersionImagick ());
199205
200206 if (!$ req ->execute ()) {
201207 // Gestion de l'erreur d'insertion en BDD
@@ -245,4 +251,21 @@ public function setIsPreview(bool $isPreview): void
245251 {
246252 $ this ->isPreview = $ isPreview ;
247253 }
254+
255+ /**
256+ * @return string
257+ */
258+ public function getVersionImagick (): string
259+ {
260+ return $ this ->versionImagick ;
261+ }
262+
263+ /**
264+ * @param string $versionImagick
265+ * @return void
266+ */
267+ public function setVersionImagick (string $ versionImagick ): void
268+ {
269+ $ this ->versionImagick = $ versionImagick ;
270+ }
248271}
0 commit comments