Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.