Why small > big?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi gang:

I have a thumbnail script, which does what it is supposed to do. However, the thumbnail image generated is larger than the original image, how can that be?

Here's the script working:

http://xn--ovg.com/thickbox

And, here's the script:

<?php /* thumb from file */

/* some settings */
ignore_user_abort();
set_time_limit( 0 );
error_reporting( FATAL | ERROR | WARNING );

/* security check */
ini_set( 'register_globals', '0' );

/* start buffered output */
ob_start();

/* some checks */
if ( ! isset( $_GET['s'] ) ) die( 'Source image not specified' );

$filename = $_GET['s'];

// Set a maximum height and width
$width = 200;
$height = 200;

// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);

if ($width && ($width_orig < $height_orig))
	{
	$width = ($height / $height_orig) * $width_orig;
	}
else
	{
	$height = ($width / $width_orig) * $height_orig;
	}

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

//  Output & Content type
header('Content-type: image/jpeg');
imagejpeg($image_p, null, 100);

/* end buffered output */
ob_end_flush();
?>

---

Thanks in advance for any comments, suggestions or answers.

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux