/** * @ignore */ public function output() { Http::sendHeaderCache(-1); header('Content-Type: ' . $this->mime, true); header('Content-Length: ' . $this->size, true); header('Content-Disposition: inline;filename=' . $this->filename . '.' . $this->extension, true); // @readfile($this->source); if ($this->mime === 'image/jpeg' || $this->mime === 'image/jpg') { imagejpeg($this->image); } elseif ($this->mime === 'image/gif') { imagegif($this->image); } elseif ($this->mime === 'image/png') { imagepng($this->image); } return $this; }
/** * @ignore */ public static function getPack($uName, array $uClasses = array()) { foreach (self::$packs as $tPack) { if ($tPack['name'] !== $uName) { continue; } $tSelectedPack = $tPack; break; } if (!isset($tSelectedPack)) { return false; } $tCacheTtl = isset($tSelectedPack['cacheTtl']) ? (int) $tSelectedPack['cacheTtl'] : 0; $tBinder = new Binder($tSelectedPack['name'], $tSelectedPack['type'], $tCacheTtl, $uClasses); $tMimetype = Mime::getType($tBinder->outputType); header('Content-Type: ' . $tMimetype, true); Http::sendHeaderCache($tCacheTtl); foreach ($tSelectedPack['partList'] as $tPart) { $tBindType = isset($tPart['bindtype']) ? $tPart['bindtype'] : 'file'; $tClass = isset($tPart['class']) ? $tPart['class'] : null; if ($tBindType === 'function') { $tValue = $tPart['name']; $tPartType = isset($tPart['parttype']) ? $tPart['parttype'] : $tBinder->outputType; } elseif ($tBindType === 'string') { $tValue = $tPart['value']; $tPartType = isset($tPart['parttype']) ? $tPart['parttype'] : $tBinder->outputType; } else { $tValue = $tPart['path']; $tPartType = isset($tPart['parttype']) ? $tPart['parttype'] : pathinfo($tPart['path'], PATHINFO_EXTENSION); } $tBinder->add($tBindType, $tPartType, $tValue, $tClass); } echo $tBinder->output(); return true; }