Re: imagerotate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, March 5, 2008 11:17 am, Zeshan Uddin wrote:

> *************************
> Code for rotate.php
>
> <?php
> // File and rotation
> $filename = 'image.png';
> $degrees = 18;
>
> // Content type
> header('Content-type: image/png');
>
> // Load
> $source = imagecreatefrompng($filename);
>
> // Rotate
> $rotate = imagerotate($source, $degrees, 0);

This line does the actual rotation, and, along with $degrees = 18, is
all you need to add to the other script.

>
> // Output
> imagepng($rotate);
> ?>
>
> ============================
>
> Code for resize.php
>
> <?php
> $src_img = imagecreatefrompng('image.png');
> $srcsize = getimagesize('image.png');
>
> $dest_x = 200;
> $dest_y = (200 / $srcsize[0]) * $srcsize[1];
> $dst_img = imagecreatetruecolor($dest_x, $dest_y);
>
> imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0,
> $dest_x, $dest_y, $srcsize[0], $srcsize[1]);

You can add them here, after the image is resized, and you are done.

> header("content-type: image/png");
>
> imagepng($dst_img);
> imagedestroy($src_img);
> imagedestroy($dst_img);
> ?>
>
>
> thanks
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux