imagerotate

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

 



Image Resize & Rotation

Hi

I have 2 scripts, one for Image rotation and other image resize and they
both are working.

Image resize scripts load the picture and resize it and Image rotation
rotate the image by 90 deg. They are

two differennt files i.e. resize.php and rotate.php.

What I want to do is to combine both rotate.php & resize.php files, so when
the script resized the image than

it will call rotate script to rotate the image and display it on the
screen.. I hope I am making sence.. I am

finding hard to explain.. If u dont understand anything please let me know..


*************************
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);

// 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]);

header("content-type: image/png");

imagepng($dst_img);
imagedestroy($src_img);
imagedestroy($dst_img);
?>


thanks

[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