XOOPS  2.6.0
image.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
13 
24 include dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'mainfile.php';
26 $xoops->logger()->quiet();
27 
29 
30 $image_id = Request::getInt('id', 0);
31 if (empty($image_id)) {
32  header('Content-type: image/gif');
33  readfile(\XoopsBaseConfig::get('root-path') . '/uploads/blank.gif');
34  exit();
35 }
36 
37 $image = $helper->getHandlerImages()->getById($image_id);
38 
39 if (count($image) != 0) {
40  header('Content-type: ' . $image[$image_id]->getVar('image_mimetype'));
41  header('Cache-control: max-age=31536000');
42  header('Expires: ' . gmdate("D, d M Y H:i:s", time() + 31536000) . 'GMT');
43  header('Content-disposition: filename=' . $image[$image_id]->getVar('image_name'));
44  header('Content-Length: ' . strlen($image[$image_id]->getVar('image_body')));
45  header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $image[$image_id]->getVar('image_created')) . 'GMT');
46  echo $image[$image_id]->getVar('image_body');
47 } else {
48  header('Content-type: image/gif');
49  readfile(\XoopsBaseConfig::get('uploads-path') . '/blank.gif');
50 }
if(empty($image_id)) $image
Definition: image.php:37
static getInstance()
Definition: Xoops.php:160
exit
Definition: browse.php:104
defined('DS') or define('DS' DIRECTORY_SEPARATOR
Definition: common.php:41
$xoops
Definition: image.php:25
static get($name)
$helper
Definition: image.php:28
static getHelper($dirname= 'system')
Definition: Helper.php:27
$image_id
Definition: image.php:30