prepare ("SELECT _name, _size, _mimetype FROM _file WHERE _id = :id"); $sth->bindParam (':id', $fileId, PDO::PARAM_INT); $sth->execute (); $obj = $sth->fetch (PDO::FETCH_OBJ); if (!$obj) throw new Exception (); } catch (PDOException $e) { die (); } catch (Exception $e) { die (); } if (isset ($_GET['assume'])) $assume = (int) $_GET['assume']; else $assume = $archive->getAssume ($obj->_mimetype); if (!file_exists ($archive->getDataPath () . 'file_' . str_pad ($fileId, 7, '0', STR_PAD_LEFT)) && !file_exists ($archive->getDataPath () . 'file_' . str_pad ($fileId, 19, '0', STR_PAD_LEFT))) die (); if ($assume == Archive::IMAGE) { $filePath = $archive->getDataPath () . 'file_' . str_pad ($fileId, 19, '0', STR_PAD_LEFT); if (!file_exists ($filePath)) $filePath = $archive->getDataPath () . 'file_' . str_pad ($fileId, 7, '0', STR_PAD_LEFT); $contentType = $obj->_mimetype; resize ($filePath, $contentType, $width, $height, ($width && $height)); } else { $filePath = Instance::singleton ()->getCorePath () .'interface/file/' . $archive->getIcon ($obj->_mimetype) . '.gif'; if (!file_exists ($filePath)) die (); $binary = fopen ($filePath, 'rb'); $buffer = fread ($binary, filesize ($filePath)); fclose ($binary); header ('Content-Type: image/gif'); echo $buffer; }