andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


a few questions

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator
View previous topic :: View next topic  
Author Message
mmjaeger
Light Poster


Joined: 22 Oct 2004
Posts: 25

PostPosted: Tue Nov 09, 2004 3:24 pm    Post subject: a few questions Reply with quote

Hello Andy,

I'd like to add a few functions like the following to the dropshadow class and I was wondering what the best way would be to do it:

Code:
// rotate image
   function rotateImage($degrees) {      
        $sx=@ImageSX($this->_imgFinal);
         $sy=@ImageSY($this->_imgFinal);
      
      if ($sx > $sy) {
           $dst_x = 0;
            $dst_y = $sx - $sy;
            $newd = $sx;
        } else {
            $dst_x = $sy - $sx;
            $dst_y = 0;
            $newd = $sy;
        }
      
//        $src_img = imagecreatefromjpeg($this->_imgFinal);
        $dst_img = imagecreatetruecolor($newd,$newd);
       
        if ((($sx > $sy) && ($degrees < 180)) || (($sy > $sx) && ($degrees > 180))) {
           imagecopyresampled($dst_img,$this->_imgFinal,0,0,0,0,$sx,$sy,$sx,$sy);
        } else {
            imagecopyresampled($dst_img,$this->_imgFinal,$dst_x,$dst_y,0,0,$sx,$sy,$sx,$sy);
        }
      
        $rotated_img = imagerotate($dst_img, $degrees,0);
       
        if ($degrees != 180) {
       
      //90 CounterClockWise or Clockwise
           $this->_imgFinal = imagecreatetruecolor($sy,$sx);
            imagecopyresampled($this->_imgFinal,$rotated_img,0,0,0,0,$sy,$sx,$sy,$sx);
        } else {
           //180 Degrees
            $this->_imgFinal = imagecreatetruecolor($sx,$sy);
            imagecopyresampled($this->_imgFinal,$rotated_img,0,0,0,0,$sx,$sy,$sx,$sy);
        }
//        ImageJPEG($final_img, $targetfile);     
    }


What I discovered the way the class is set up that I always have to go through the resize function in order to get the $this->imgFinal value.

First of all, is there a loss in image quality if I always have to go through the resize function? Is there another way to add some functions without going through the resize function and how?

Thank you very much for your input.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group