1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00
php-e107/e107_images/thumb.php

65 lines
1.5 KiB
PHP
Raw Normal View History

2006-12-02 04:36:16 +00:00
<?php
/*
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
* $Source: /cvs_backup/e107_0.8/e107_images/thumb.php,v $
2010-02-10 18:18:01 +00:00
* $Revision$
* $Date$
* $Author$
*/
2006-12-02 04:36:16 +00:00
/*
Usage: simply replace your <img src='filename.jpg'
with
<img src='".e_IMAGE_ABS."thumb.php?filename.jpg+size"' />
2006-12-02 04:36:16 +00:00
or
<img src='".e_IMAGE_ABS."thumb.php?<full path to file>/filename.jpg+size"' />
eg <img src='".e_IMAGE_ABS."thumb.php?home/images/myfilename.jpg+100)"' />
By default a small image is upsized. To render the image unchanged, append '+noscale', thus:
eg <img src='".e_IMAGE_ABS."thumb.php?home/images/myfilename.jpg+100+noscale)"' />
2006-12-02 04:36:16 +00:00
*/
$_E107['minimal'] = TRUE;
2006-12-02 04:36:16 +00:00
require_once("../class2.php");
require_once(e_HANDLER."resize_handler.php");
if (e_QUERY)
{
$tmp = explode('+',rawurldecode(e_QUERY));
if(strpos($tmp[0], '/') === 0 || strpos($tmp[0], ":") >= 1)
{
$source = $tmp[0]; // Full path to image specified
}
else
{
$source = "../".str_replace('../','',$tmp[0]);
}
if (!$source)
{
echo "No image name.<br />";
2006-12-02 04:36:16 +00:00
exit;
}
$newsize = intval($tmp[1]);
if (($newsize < 5) || ($newsize > 4000)) // Pretty generous limits
{
echo "Bad image size: {$newsize}<br />";
exit;
}
$opts = varset($tmp[2],'upsize');
if(!resize_image($source, 'stdout', $newsize, $opts))
{
2011-03-14 21:10:20 +00:00
$source = $tp->toDB($source);
echo "Couldn't find: {$source}<br />";
}
}
2006-12-02 04:36:16 +00:00