Location: PHPKode > projects > Pointter PHP CMS > pointtercms_package/pointtercms_package/pointtercms/admin/functions/imagesize.php
<?php 

/***************************************************************************
 * Product Name			: Pointter PHP Content Management System
 * Version 			: V 1.2
 * Release Date			: 01/02/11
 * Copyright			: (C) 2011 PangramSoft / Murat Cevik
 * Program URL			: http://www.pointter.com
 * Company URL			: http://www.pangramsoft.com
 * Email Address                : hide@address.com
 
 ***************************************************************************/
 

/****************************************************************************

Pointter PHP Content Management System is licensed under Creative Commons Attribution Non-commercial No Derivatives 3.0 Unported (by-nc-nd) License.
To view a copy of this license, (a) visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or (b) send a letter to Creative Commons, 171 2nd Street, 
Suite 300, San Francisco, California, 94105, USA.” 

You must not remove/modify/alter the copyright informations both visible and invisible forms in the source code and you must not remove/modify/alter 
the copyright informations in the footer part of the script including the Pointter image (png format file), hard link and title tag.

Please contact the copyright holder PangramSoft / Murat Cevik for a commercial license to remove the copyright information in the footer part of the script.


*****************************************************************************/

$filename=$target_copy;

//Width[0] And Height[1]
$size = getimagesize($filename);
$format_type=$size[0]/$size[1];


//For Resolution 640x480

if ($size[0]==640 OR $size[1]==640)
{ 

if ($format_type>1)
{
//Resize Numbers
$left=140;
$top=60;
$crop_width=360;
$crop_height=360;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,360,360);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}
else if ($format_type<1)
{
//Resize Numbers
$left=60;
$top=140;
$crop_width=360;
$crop_height=360;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,360,360);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}

}

//For Resolution 800x600

if ($size[0]==800 OR $size[1]==800)
{ 

if ($format_type>1)
{
//Resize Numbers
$left=175;
$top=75;
$crop_width=450;
$crop_height=450;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,450,450);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}
else if ($format_type<1)
{
//Resize Numbers
$left=75;
$top=175;
$crop_width=450;
$crop_height=450;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,450,450);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}

}


//For Resolution 1024x768

if ($size[0]==1024 OR $size[1]==1024)
{ 

if ($format_type>1)
{
//Resize Numbers
$left=224;
$top=96;
$crop_width=576;
$crop_height=576;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,576,576);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}
else if ($format_type<1)
{
//Resize Numbers
$left=96;
$top=224;
$crop_width=576;
$crop_height=576;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,576,576);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}

}


//For Resolution 1280x960

if ($size[0]==1280 OR $size[1]==1280)
{ 

if ($format_type>1)
{
//Resize Numbers
$left=280;
$top=120;
$crop_width=720;
$crop_height=720;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,720,720);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}
else if ($format_type<1)
{
//Resize Numbers
$left=120;
$top=280;
$crop_width=720;
$crop_height=720;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,720,720);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}

}


//For Resolution 2048x1536

if ($size[0]==2048 OR $size[1]==2048)
{ 

if ($format_type>1)
{
//Resize Numbers
$left=448;
$top=192;
$crop_width=1152;
$crop_height=1152;

//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,1152,1152);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}
else if ($format_type<1)
{
//Resize Numbers
$left=192;
$top=448;
$crop_width=1152;
$crop_height=1152;
//Create New Image
$canvas=imagecreatetruecolor($crop_width,$crop_height);

if (exif_imagetype($filename)==1)
$final=imagecreatefromgif($filename);

if (exif_imagetype($filename)==2)
$final=imagecreatefromjpeg($filename);

if (exif_imagetype($filename)==3)
$final=imagecreatefrompng($filename);

imagecopy($canvas,$final,0,0,$left,$top,$size[0],$size[1]);
$thumb=imagecreatetruecolor(130,130);
imagecopyresampled($thumb,$canvas,0,0,0,0,130,130,1152,1152);

if (exif_imagetype($filename)==1)
imagegif($thumb,"$target");

if (exif_imagetype($filename)==2)
imagejpeg($thumb,"$target",100);

if (exif_imagetype($filename)==3)
imagepng($thumb,"$target",0);
}

}

?>
Return current item: Pointter PHP CMS