Jump to content

script help.


darkfreaks

Recommended Posts

Thumbs.php

 


<?php
#################################################################
## PHP Pro Bid v6.00															##
##-------------------------------------------------------------##
## Copyright ©2007 PHP Pro Software LTD. All rights reserved.	##
##-------------------------------------------------------------##
#################################################################

include_once('includes/class_image.php');

$image = new image();

(string) $pic = null;

$pic = eregi_replace(' ','%20',$_GET['pic']);

$thumbnail_width = abs(intval($_GET['w']));
$is_square = ($_GET['sq']=='Y')? true : false;
$is_border = ($_GET['b']=='Y') ? true : false;

(array) $info = null;

$info = @getimagesize($pic);
list($im_width, $im_height, $im_type, $im_attr) = $info;

if (empty($info)||$im_type>3) $pic = 'images/broken.gif';

$pic_no_spaces = eregi_replace('%20','',$pic);

$pic_cached = eregi_replace($image->image_basedir,'',$pic_no_spaces);

if ($_GET['check']=='phpinfo')
{
phpinfo();
}
else
{
$allowed_extension = $image->allowed_extension($pic);

if (isset($pic) && $thumbnail_width>0 && $allowed_extension)
{
	/* check to see if file already exists in cache, and output it with no processing if it does */
	$cached_filename = $image->set_cache_filename($pic_cached, $thumbnail_width, $is_square, $is_border);

	if (is_file($cached_filename)) /* display cached filename */
	{
		header('Content-type: image/jpeg');
		header('Location: ' . $cached_filename . '?' . rand(2,9999));
	}
	else /* create new thumbnail, and add it into the cache directory as well */
	{
		header('Content-type: image/jpeg');

		$cache_output = $image->set_cache_filename($pic_cached, $thumbnail_width, $is_square, $is_border);
		$image->generate_thumb($pic, $thumbnail_width, $is_square, $is_border, $cache_output);

		header('Location: ' . $cache_output . '?' . rand(2,9999));
	}
}
else if (!isset($pic))
{
	echo "<strong>ERROR:</strong> No image submitted";
}
else if ($thumbnail_width<=0)
{
	echo "<strong>ERROR:</strong> Invalid resizing option";
}
else if (!$allowed_extension)
{
	echo "<strong>ERROR:</strong> Prohibited file extension";
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/68449-script-help/#findComment-344140
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.