private function readImage(PlUpload $upload) { if ($upload->exists() && $upload->isType('image')) { list($this->imgx, $this->imgy, $this->imgtype) = $upload->imageInfo(); $this->img = $upload->getContents(); $upload->rm(); } }
private function read(PlUpload $upload) { $this->valid = $upload->resizeImage(240, 300, 160, 0, SIZE_MAX); if (!$this->valid) { $this->trigError('Le fichier que tu as transmis n\'est pas une image valide, ou est trop gros pour être traité.'); } $this->data = $upload->getContents(); list($this->x, $this->y, $this->mimetype) = $upload->imageInfo(); $upload->rm(); }
private function upload_image(PlPage $page, PlUpload $upload) { if (@(!$_FILES['image']['tmp_name']) && !Env::v('image_url')) { return true; } if (!$upload->upload($_FILES['image']) && !$upload->download(Env::v('image_url'))) { $page->trigError('Impossible de télécharger l\'image'); return false; } elseif (!$upload->isType('image')) { $page->trigError('Le fichier n\'est pas une image valide au format JPEG, GIF ou PNG.'); $upload->rm(); return false; } elseif (!$upload->resizeImage(200, 300, 100, 100, 32284)) { $page->trigError('Impossible de retraiter l\'image'); return false; } return true; }