rotate an image
| From: | PJ | Date: | Mon, 01 Jun 2009 21:28:52 +0000 |
| Subject: | rotate an image | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-293458@lists.php.net to get a copy of this message | ||
Not replace images. R o t a t e... like 15 degrees clockwise???
I chacked the manual and what is suggested doesn't seem to want to work.
I have GD enabled, but all I get is a garbled output on the page.
Her's what was offered:
|<?php
// File and rotation
$filename = 'test.jpg';
$degrees = 180;
// Content type
header('Content-type: image/jpeg'); This has to be in the header!!!! (MY
comment)
// Load
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, $degrees, 0);
// Output
imagejpeg($rotate);
?> |
I want to display an image rotated (canted, if you prefer) to the right
or left next to text.
There's not much (or too much) info on how to do this.
Obviously, I can resize, rotate and create a png file with transparent
bg... but why go through all that hassle?
Any ideas, anyone?
--
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- pj@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php