Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class img_opt
- {
- var $max_width;
- var $max_height;
- var $path;
- var $img;
- var $new_width;
- var $new_height;
- var $mime;
- var $image;
- var $width;
- var $height;
- DEFINE("YAHOO", "blah");
- function max_width($width)
- {
- $this->max_width = $width. YAHOO;
- }
- function max_height($height)
- {
- $this->max_height = $height;
- }
- function image_path($path)
- {
- $this->path = $path;
- }
- function get_mime()
- {
- $img_data = getimagesize($this->path);
- $this->mime = $img_data['mime'];
- }
- function create_image()
- {
- switch($this->mime)
- {
- case 'image/jpeg':
- $this->image = imagecreatefromjpeg($this->path);
- break;
- case 'image/gif':
- $this->image = imagecreatefromgif($this->path);
- break;
- case 'image/png':
- $this->image = imagecreatefrompng($this->path);
- break;
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment