Forum Moderators: coopster

Message Too Old, No Replies

ImageMagick flip flop and php

Need some help getting started

         

twist

4:45 am on Jan 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to use ImageMagick to flip and flop three 30x30 gif images that are used on every page of my website. I could easily just keep using 4 images but all 4 images are the same except for vertical and horizontal. So I simply want to rotate around one of the images to fill in the other three corners.

1) What kind of burden will this put on the server?

2) Will this delay the loading of my webpage?

3) Is it worth it or should I just stick with the 4 gifs?

4) I have found some examples of using ImageMagick but someone could save me tons of time if they could help sum it up. Most of the examples are long and somewhat complicated. I only need to flip and flop. Here is a example I lifted off my web hosts message boards on how to resize. How could I change this to flip or flop?

*edit* Just found the button to edit post, now if I could just delete the whole thread.

[edited by: twist at 6:39 am (utc) on Jan. 17, 2004]

twist

5:05 am on Jan 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, forget imagemagick I think the GD Library has what I need.

I found this script, now how do I add my image and rotate it, or can I?


<?
Header( "Content-type: image/gif" );
$height = 30;
$width = 30;
$im = ImageCreate( $width, $height );
$bck = ImageColorAllocate( $im, 10,110,100 );
$white = ImageColorAllocate( $im, 255, 255, 255 );
imageellipse( $im, 150, 150, 100, 200, $white );
ImagePNG( $im );
?>

twist

5:27 am on Jan 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, almost there...

I found this code, the guy had a typo. That was fun trying to figure that out.

Original was like this,
ImageString( $img, 3, 20, 10, "Text", $red): ImagePNG( $img );

Should have been,
ImageString( $img, 3, 20, 10, "Text", $red); ImagePNG( $img );

Anyway, I can now grab and display the image, just need to know how to rotate it. I wish I knew how to edit posts I would edit my first one :(


<?
header( "Content-type: image/gif" );
$img = ImageCreateFromGif("image.gif");
ImageString( $img, 3, 20, 10, "Text", $red);
ImagePNG( $img );
?>

Im using ImagePNG because it give me a error on ImageGIF, I read they removed it for legal reasons. My page still displays a gif though, will this cause any problems?

twist

6:38 am on Jan 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nevermind, in my rush to find a way to replace the dhtml flip() and flop() I completely overlooked that fact that if I use gd libraries to create rotated versions of the same image that the client will still have to download the new images *bangs head on wall* so I guess the whole point is moot. Feel free to delete thread.