PHP Help - How do I call this function?
04-02-06, 01:30 PM
Newbie Coder
Join Date: Mar 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Help - How do I call this function?
Please see
http://www.zend.com/codex.php?id=1101&single=1
I'm trying to turn my image sepia (third function in above URL)
PHP Code:
function sepia ( $tintR = 80 , $tintG = 43 , $tingB = - 23 , $rateR = .229 , $rateG = .587 , $rateB = .114 , $whiteness = 3 )
{
for ( $x = 0 ; $x < $this -> numColors ; $x ++)
{
$src_colors = imagecolorsforindex ( $this -> resource_image , $x );
$new_color = min ( 255 , abs ( $src_colors [ "red" ] * $rateR + $src_colors [ "green" ] * $rateG + $src_colors [ "blue" ] * $rateB ) + $whiteness );
$r = min ( 255 , $new_color + $tintR );
$g = min ( 255 , $new_color + $tintG );
$b = min ( 255 , $new_color + $tintB );
imagecolorset ( $this -> resource_image , $x , $r , $g , $b );
}
}
I dont know how to call this function. would i do sepia($imagesrc) ?
I appreciate any help.
04-02-06, 01:39 PM
Aspiring Coder
Join Date: Jan 2006
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by INTEL
Please see
http://www.zend.com/codex.php?id=1101&single=1
I'm trying to turn my image sepia (third function in above URL)
PHP Code:
function sepia ( $tintR = 80 , $tintG = 43 , $tingB = - 23 , $rateR = .229 , $rateG = .587 , $rateB = .114 , $whiteness = 3 )
{
for ( $x = 0 ; $x < $this -> numColors ; $x ++)
{
$src_colors = imagecolorsforindex ( $this -> resource_image , $x );
$new_color = min ( 255 , abs ( $src_colors [ "red" ] * $rateR + $src_colors [ "green" ] * $rateG + $src_colors [ "blue" ] * $rateB ) + $whiteness );
$r = min ( 255 , $new_color + $tintR );
$g = min ( 255 , $new_color + $tintG );
$b = min ( 255 , $new_color + $tintB );
imagecolorset ( $this -> resource_image , $x , $r , $g , $b );
}
}
I dont know how to call this function. would i do sepia($imagesrc) ?
I appreciate any help.
My guess is you call it by doing: -
serpia();
And dont specify any arguements.
04-02-06, 01:50 PM
Newbie Coder
Join Date: Mar 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
thanks for the reply, but how do i tell it what image im inputting?
04-02-06, 01:51 PM
Community Liaison
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
As it's part of a class called "imageFiltersIndex", you'd call it one of two ways:
...or:
...after including the class, of course.
Last edited by Keith; 04-02-06 at 01:55 PM .
04-02-06, 01:55 PM
Community Liaison
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Quote:
Originally Posted by INTEL
thanks for the reply, but how do i tell it what image im inputting?
It tells you exactly how to do that in the very page you linked to.
04-02-06, 01:57 PM
Community Liaison
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
04-02-06, 01:59 PM
Newbie Coder
Join Date: Mar 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
can't believe i missed it.
thanks for all the replies.
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off