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(); }
function handler_photo($page, $eid = null, $valid = null) { if ($eid && $eid != 'valid') { $res = XDB::query("SELECT * FROM announce_photos WHERE eid = {?}", $eid); if ($res->numRows()) { $photo = $res->fetchOneAssoc(); pl_cached_dynamic_content_headers("image/" . $photo['attachmime']); echo $photo['attach']; exit; } } elseif ($eid == 'valid') { $valid = Validate::get_request_by_id($valid); if ($valid && $valid->img) { pl_cached_dynamic_content_headers("image/" . $valid->imgtype); echo $valid->img; exit; } } else { $upload = new PlUpload(S::user()->login(), 'event'); if ($upload->exists() && $upload->isType('image')) { pl_cached_dynamic_content_headers($upload->contentType()); echo $upload->getContents(); exit; } } global $globals; pl_cached_dynamic_content_headers("image/png"); echo file_get_contents($globals->spoolroot . '/htdocs/images/logo.png'); exit; }
function handler_photo_announce($page, $eid = null) { if ($eid) { $res = XDB::query('SELECT * FROM group_announces_photo WHERE eid = {?}', $eid); if ($res->numRows()) { $photo = $res->fetchOneAssoc(); pl_cached_dynamic_content_headers("image/" . $photo['attachmime']); echo $photo['attach']; exit; } } else { $upload = new PlUpload(S::user()->login(), 'xnetannounce'); if ($upload->exists() && $upload->isType('image')) { pl_cached_dynamic_content_headers($upload->contentType()); echo $upload->getContents(); exit; } } global $globals; pl_cached_dynamic_content_headers("image/png"); echo file_get_contents($globals->spoolroot . '/htdocs/images/logo.png'); exit; }