WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : array img_resize(string 'path to source image', string 'path to destination image', string mode, int size); modes: "h" - Height "w" - Width "a" - auto (resizes by the largest dimension)
Categories : Graphics, PHP Update Picture
Jeremiah Davis
Date : Jul 03rd 1998
Grade : 3 of 5 (graded 4 times)
Viewed : 9668
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Jeremiah Davis
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

/*---------------------------------/// img_resize()
///----------------------------------------------*/
function img_resize($path2image,$path2thumb,$axis,$size)
{

$imageName = basename($path2image);
$thumbName = basename($path2thumb);

if (ereg("\.gif$",$img_name) || ereg("\.jpe?g",$img_name))
{

$djpeg = "/usr/bin/djpeg";
$cjpeg = "/usr/bin/cjpeg";
$pnmscale = "/usr/bin/pnmscale";
$giftopnm = "/usr/bin/giftopnm";
$ppmtogif = "/usr/bin/ppmtogif";
$ppmquant = "/usr/bin/ppmquant";

$imageAttributes = GetImageSize($path2image);

$imageWidth = $imageAttributes[0];
$imageHeight = $imageAttributes[1];

if ($imageWidth < $size && $imageHeight < $size)
{
@exec("cp $path2image $path2thumb");
chmod($path2thumb, 0666);
}
else
{
if ($axis == "h" || $axis == "a" && $imageHeight > $imageWidth)
{
switch ($imageAttributes[2])
{
case 1:
exec("$giftopnm $path2image | $pnmscale -height $size | $ppmquant 256
| $ppmtogif -interlace > $path2thumb");
chmod($path2thumb, 0666);
break;
case 2:
exec("$djpeg $path2image | $pnmscale -height $size | $cjpeg -outfile
$path2thumb");
chmod($path2thumb, 0666);
break;
case "":
return("");
break;
}
}

if ($axis == "w" || $axis == "a" && $imageWidth > $imageHeight)
{
switch ($imageAttributes[2])
{
case 1:
exec("$giftopnm $path2image | $pnmscale -width $size | $ppmquant 256
| $ppmtogif -interlace > $path2thumb");
chmod($path2thumb, 0666);
break;
case 2:
exec("$djpeg $path2image | $pnmscale -width $size | $cjpeg -outfile
$path2thumb");
chmod($path2thumb, 0666);
break;
case "":
return("");
break;
}
}
}
}
else
{
echo '<FONT SIZE=4>'
.'Unable to complete Resize Function, The file being processed is not a
valid image file. Please use only .GIF or .JPG files'
.'<BR CLEAR=ALL>'
.'</FONT>'
."Hit your browser's back button to continue"
.'<P>';
}
}
/*---------------------------------/// img_resize()
///----------------------------------------------*/



Simple PHP/3 Access Counter (using GD and DBM functions)
Categories : Databases, PHP, Graphics, HTML and PHP, dBase
crop and resize image class using gd library function
Categories : PHP, PHP Classes, GD image library, Graphics
Simple class that uses GD to draw pie charts. After the class definition there's some sample code to demonstrate how you use the class.
Categories : Graphics, PHP, PHP Classes, GD image library, Charts and Graphs
Generate image with random number (CAPTCHA)
Categories : PHP, GD image library, Graphics, Security
Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
Render TTF Text to PNG. Text message, font, size, rotation, padding, color, background, and transparency can all be defined via URL.
Categories : PHP, PHP Classes, Graphics
Create MRTG Graphic from rrd database (Need MRTG and RRDTool installed).
Categories : PHP, Network, Graphics
GetImageSize -- Get the size of a GIF, JPEG, PNG or SWF image
Categories : PHP, PHP Functions, Graphics
HTML_Graphs provides a simple PHP interface for creating pure HTML charts.
Categories : Graphics, PHP, PHP Classes, Charts and Graphs
Image Cache
Categories : Graphics, PHP Classes, PHP
Create a Thumbnail Using PHP, GD and Exif
Categories : PHP, Graphics, Exif, GD image library
PHP Round Clock - Must have Gif support to use this.
Categories : PHP, Date Time, Graphics
Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality.
Categories : PHP, GD image library, Graphics
Simple way of scaling any image to fit either given width or height.
Categories : PHP, Graphics, Arrays
Three Cool Classes and One Trick
Categories : PHP, PHP Classes, Graphics, Email