Overview
Comment: | Utilisation de la nouvelle version de \KD2\Image |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
6de6092e2e624f4df8daa9181c2296b9 |
User & Date: | bohwaz on 2017-08-31 07:24:27 |
Other Links: | branch diff | manifest | tags |
Context
2017-08-31
| ||
07:24 | Modernisation code check-in: 10e35860a4 user: bohwaz tags: dev | |
07:24 | Utilisation de la nouvelle version de \KD2\Image check-in: 6de6092e2e user: bohwaz tags: dev | |
2017-08-30
| ||
05:31 | Mise à jour recette pour récupération des dépendances check-in: 090b738a82 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Fichiers.php from [5ceea37710] to [6cbd651b6a].
1 2 3 4 5 6 7 8 9 10 11 | <?php namespace Garradin; class Fichiers { public $id; public $nom; public $type; public $image; public $datetime; | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 | <?php namespace Garradin; use KD2\Image; class Fichiers { public $id; public $nom; public $type; public $image; public $datetime; |
︙ | ︙ | |||
55 56 57 58 59 60 61 | { return $size; } foreach (self::$allowed_thumb_sizes as $s) { if ($s >= $size) | > | > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | { return $size; } foreach (self::$allowed_thumb_sizes as $s) { if ($s >= $size) { return $s; } } return max(self::$allowed_thumb_sizes); } /** * Constructeur de l'objet pour un fichier |
︙ | ︙ | |||
290 291 292 293 294 295 296 | public function serveThumbnail($width = self::TAILLE_MINIATURE) { if (!$this->image) { throw new \LogicException('Il n\'est pas possible de fournir une miniature pour un fichier qui n\'est pas une image.'); } | | > > > | > | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | public function serveThumbnail($width = self::TAILLE_MINIATURE) { if (!$this->image) { throw new \LogicException('Il n\'est pas possible de fournir une miniature pour un fichier qui n\'est pas une image.'); } if (!in_array($width, self::$allowed_thumb_sizes)) { throw new UserException('Cette taille de miniature n\'est pas autorisée.'); } $cache_id = 'fichiers.' . $this->id_contenu . '.thumb.' . (int)$width; $path = Static_Cache::getPath($cache_id); // La miniature n'existe pas dans le cache statique, on la crée if (!Static_Cache::exists($cache_id)) { $source = $this->getFilePathFromCache(); (new Image($source))->resize($width)->save($path); } return $this->_serve($path, $this->type); } /** * Servir un fichier local en HTTP |
︙ | ︙ |