/**
  * Méthode permettant de redimensionner une image uploadée (enregistrée en base)
  * http://www.site.com/statique/resize/id:2/w:200/h:200/
  *
  * $_GET["id"]		int		Id de l'upload
  * $_GET["w"]		int		largeur max souhaitée
  * $_GET["h"]		int		hauteur max souhaitée
  * @return void
  */
 public function resize()
 {
     if (!Form::isNumeric($_GET["id"]) || !Form::isNumeric($_GET["w"]) || !Form::isNumeric($_GET["h"])) {
         Go::to404();
     }
     if (!file_exists($image = ModelUpload::getPathById($_GET["id"]))) {
         Go::to404();
     }
     preg_match(File::REGEXP_EXTENSION, $image, $extract);
     $ext = $extract[1];
     $folder_cache = "includes/applications/" . Core::$application . "/_cache/imgs/";
     $file_cache = $folder_cache . "resize_" . $_GET["id"] . "_" . $_GET["w"] . "_" . $_GET["h"] . "." . $ext;
     if ($app != "main") {
         Configuration::$server_url .= "../";
     }
     if (file_exists($file_cache)) {
         Header::location(Configuration::$server_url . $file_cache);
     }
     Image::createCopy($image, $file_cache, $_GET["w"], $_GET["h"]);
     Header::location(Configuration::$server_url . $file_cache);
 }
示例#2
0
 /**
  * Méthode permettant d'ajouter une nouvelle miniature dans la liste de traitement
  * @deprecated
  * @param  $pName
  * @param  $pFolder
  * @param  $pWidth
  * @param  $pHeight
  * @return void
  */
 public function addMiniature($pName, $pFolder, $pWidth, $pHeight)
 {
     array_push($this->miniatures, array("pathFile" => $pFolder . $pName . "." . $this->fileType, "width" => $pWidth, "height" => $pHeight));
     if ($this->isUpload) {
         Image::createCopy($this->pathFile, $pFolder . $pName . "." . $this->fileType, $pWidth, $pHeight);
     }
 }