Vergleich inc/functions_image.php - 1.2.0 - 1.2.14

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: functions_image.php 2163 2006-08-30 05:53:05Z chris $

 * $Id: functions_image.php 3134 2007-06-14 19:32:53Z dennis $

 */


 */


 
/**
* Generates a thumbnail
*
* @param string filename
* @param string upload path
* @param string thumbnail filename
* @param int maximum thumbnail height
* @param int maximum thumbnail width
* @return array returns an array with error code and filename (Code 1: Thumbnail generated; Code 3: Could not create thumbnail; Code 4: Image does not need to be scaled)
*/

function generate_thumbnail($file, $path, $filename, $maxheight, $maxwidth)
{

function generate_thumbnail($file, $path, $filename, $maxheight, $maxwidth)
{

 
	// Check if thumbnail can be generated and if the file is valid image

	if(!function_exists("imagecreate"))
{
$thumb['code'] = 3;

	if(!function_exists("imagecreate"))
{
$thumb['code'] = 3;

Zeile 21Zeile 32
	{
$thumb['code'] = 3;
return $thumb;

	{
$thumb['code'] = 3;
return $thumb;

	}		



	}

// Only generate a thumbnail if image is larger than maximum thumbnail size

	if(($imgwidth >= $maxwidth) || ($imgheight >= $maxheight))
{

	if(($imgwidth >= $maxwidth) || ($imgheight >= $maxheight))
{

 
		// Up the memory limit if needed

		check_thumbnail_memory($imgwidth, $imgheight, $imgtype, $imgbits, $imgchan);

		check_thumbnail_memory($imgwidth, $imgheight, $imgtype, $imgbits, $imgchan);

		


		
// Get the image into memory based on file type

		if($imgtype == 3)
{
if(@function_exists("imagecreatefrompng"))
{
$im = @imagecreatefrompng($file);

		if($imgtype == 3)
{
if(@function_exists("imagecreatefrompng"))
{
$im = @imagecreatefrompng($file);

			}
}

			}
}

		elseif($imgtype == 2)
{
if(@function_exists("imagecreatefromjpeg"))

		elseif($imgtype == 2)
{
if(@function_exists("imagecreatefromjpeg"))

Zeile 46Zeile 61
			{
$im = @imagecreatefromgif($file);
}

			{
$im = @imagecreatefromgif($file);
}

		}
else
{

		}
else
{

			$thumb['code'] = 3;
return $thumb;
}

			$thumb['code'] = 3;
return $thumb;
}

Zeile 57Zeile 72
			$thumb['code'] = 3;
return $thumb;
}

			$thumb['code'] = 3;
return $thumb;
}

 
		
// Scale the image and resample

		$scale = scale_image($imgwidth, $imgheight, $maxwidth, $maxheight);
$thumbwidth = $scale['width'];
$thumbheight = $scale['height'];

		$scale = scale_image($imgwidth, $imgheight, $maxwidth, $maxheight);
$thumbwidth = $scale['width'];
$thumbheight = $scale['height'];

Zeile 71Zeile 88
			@imagecopyresized($thumbim, $im, 0, 0, 0, 0, $thumbwidth, $thumbheight, $imgwidth, $imgheight);
}
@imagedestroy($im);

			@imagecopyresized($thumbim, $im, 0, 0, 0, 0, $thumbwidth, $thumbheight, $imgwidth, $imgheight);
}
@imagedestroy($im);

 
		
// Output image to file based on file type

		if(!function_exists("imagegif") && $imgtype == 1)
{
$filename = str_replace(".gif", ".jpg", $filename);

		if(!function_exists("imagegif") && $imgtype == 1)
{
$filename = str_replace(".gif", ".jpg", $filename);