00001 <?PHP 00002 00003 # 00004 # Axis--Image--Test.php 00005 # Test scaffolding for the AxisPHP Image object. 00006 # 00007 # Copyright 2002-2003 Axis Data 00008 # This code is free software that can be used or redistributed under the 00009 # terms of Version 2 of the GNU General Public License, as published by the 00010 # Free Software Foundation (http://www.fsf.org). 00011 # 00012 # Author: Edward Almasy (ealmasy@axisdata.com) 00013 # 00014 # Part of the AxisPHP library v1.2.5 00015 # For more information see http://www.axisdata.com/AxisPHP/ 00016 # 00017 00018 require_once("Axis--Image.php"); 00019 00020 $Img = new Image("TestImage1.jpg"); 00021 printf("Image Manipulation Method: %s<br>\n", $Img->ImageManipulationMethod()); 00022 00023 ?>Original #1:<br><img src="TestImage1.jpg"><br><br><br><?PHP 00024 00025 $Img = new Image("TestImage1.jpg"); 00026 $Img->ScaleTo(100, 100); 00027 $Img->SaveAs("TestImage--TEMP1.jpg"); 00028 ?>JPEG scaled to 100w by 100h:<br><img src="TestImage--TEMP1.jpg"><br><br><br><?PHP 00029 00030 $Img = new Image("TestImage1.jpg"); 00031 $Img->ScaleTo(100, 100, TRUE); 00032 $Img->SaveAs("TestImage--TEMP4.jpg"); 00033 ?>JPEG scaled to 100w by 100h with aspect ration maintained:<br><img src="TestImage--TEMP4.jpg"><br><br><br><?PHP 00034 00035 $Img = new Image("TestImage1.jpg"); 00036 $Img->CropTo(300, 200, 50, 300); 00037 $Img->SaveAs("TestImage--TEMP2.jpg"); 00038 ?>JPEG cropped to 300w by 200h:<br><img src="TestImage--TEMP2.jpg"><br><br><br><?PHP 00039 00040 $Img = new Image("TestImage1.jpg"); 00041 $Img->CropTo(300, 200, 50, 300); 00042 $Img->SaveAs("TestImage--TEMP2.jpg"); 00043 ?>JPEG cropped to 300w by 200h:<br><img src="TestImage--TEMP2.jpg"><br><br><br><?PHP 00044 00045 if (imagetypes() & IMG_GIF) 00046 { 00047 $Img = new Image("TestImage1.jpg"); 00048 $Img->ScaleTo(50, 300); 00049 $Img->SaveAs("TestImage--TEMP3.gif"); 00050 ?>GIF scaled to 50w by 300h:<br><img src="TestImage--TEMP3.gif"><br><br><br><?PHP 00051 } 00052 else 00053 { 00054 print("GIF image output not supported on this server<br><br><br>\n"); 00055 } 00056 00057 ?>Original #2:<br><img src="TestImage2.jpg"><br><br><br><?PHP 00058 00059 $Img = new Image("TestImage2.jpg"); 00060 $Img->ScaleTo(100, 100, TRUE); 00061 $Img->SaveAs("TestImage--TEMP5.jpg"); 00062 ?>JPEG scaled to 100w by 100h with aspect ration maintained:<br><img src="TestImage--TEMP5.jpg"><br><br><br><?PHP 00063 00064 $Img = new Image("TestImage2.jpg"); 00065 $Img->ScaleTo(100, 200, TRUE); 00066 $Img->SaveAs("TestImage--TEMP6.jpg"); 00067 ?>JPEG scaled to 100w by 200h with aspect ration maintained:<br><img src="TestImage--TEMP6.jpg"><br><br><br><?PHP 00068 00069 $Img = new Image("TestImage2.jpg"); 00070 $Img->ScaleTo(200, 100, TRUE); 00071 $Img->SaveAs("TestImage--TEMP7.jpg"); 00072 ?>JPEG scaled to 200w by 100h with aspect ration maintained:<br><img src="TestImage--TEMP7.jpg"><br><br><br><?PHP 00073 00074 ?> 00075