php image re-size script copy and past this script
<?php class SimpleImage { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == IMAGETYPE_GIF ) { $this->image = imagecreatefromgif($filename); } elseif( $this->image_type == IMAGETYPE_PNG ) { $this->image = imagecreatefrompng($filename); } } function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image,$filename,$compression); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image,$filename); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image,$filename); } if( $permissions != null) { chmod($filename,$permissions); } } function output($image_type=IMAGETYPE_JPEG) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image); } } function getWidth() { return imagesx($this->image); } function getHeight() { return imagesy($this->image); } function resizeToHeight($height) { $ratio = $height / $this->getHeight(); $width = $this->getWidth() * $ratio; $this->resize($width,$height); } function resizeToWidth($width) { $ratio = $width / $this->getWidth(); $height = $this->getheight() * $ratio; $this->resize($width,$height); } function scale($scale) { $width = $this->getWidth() * $scale/100; $height = $this->getheight() * $scale/100; $this->resize($width,$height); } function resize($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } ?>
<?php $image = new SimpleImage(); $image->load('picture.jpg'); $image->resize(250,400); $image->save('picture2.jpg'); ?>
x-xmax
Country UNITEDSTATES
City Ohio
Posted On 30/03/2012
5
Other Pages
- php word limit
- sql replace
- PHP prepend leading zero before single digit number
- All About Mysql with example advance query
- jquery add new input field
- WordPress Get Specific Page content
- WordPress Get resent post
- php whois domain checking simple script
- simple css horizontal menu code
- youtube php api to reading title & length
- div Tab menu using CSS
- Textarea resize on hove and mouse click
- Create Tab Menu Using Div
- simple javascript lightbox code
- Renaming & reading file name using .bat
- simple jquery slider code
- rewrite rules htaccess or how to create short url in php
- php Set Timezone by country
- javascript new tab on popup window code
- simple jquery for date picker
- php remove spacial characters
- single page website
- simple dropdown menu without javascript
- php deleting multiple data using checkbox
- SELECT OR DESELECT Multiple Checkbox
- php image re-size script
- php read file from directory
- php connect to mysql
- PHP tips and tricks
- Get and output the source of the homepage of a website
- php login scrpit
- php image watermark script
- PHP to Force a File Download
- php pagination script
- Use a javascript confirm box to ask the user if they want to delete
- simple php file upload code
- How to set a div to auto adjust it's height with available browser height
- php script send email with attachment
- Testing interview questions and answers
- Mysql interview questions and answers
- CSS3 interview questions and answers
- HTML5 interview questions and answers
- PHP interview questions and answers
- How do I clear all the entries from just one table in MySQL with PHP
- PHP Reading a file line by line
- filter email id from a string
- php mysql how to get unique data from table
- php how to short array by alphabetical order
- javascrpit iframe break code
- php defining maximum character of string
- php Remove extension from a filename
- Do you know you can watch Star wars Text movie from your computer.
- Interesting Computer tricks -- try it
- how to Clear default value of text input using Javascript
- improve your internet speed using gpedit.msc
- php xml site map script