Jacob Brackett

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromJacob Brackett
ToMe
Subjectturning and image on one of four random sides and displaying the image.
Date22 March 2006 18:41
Hi,
        I am trying to get an image to be displayed in one of four random 
sides: right-sideup, on its left side, on its right side, and upside-down. 
 The problem I have is that I can only take a random picture saved 
rightside up.  The images are dynamically created by users and saved to 
the database I am pulling from.  I need to get the image and flip it to a 
random side and display it in a random order with other images (flipped on 
a random side) on the site.  I can't seem to find any scripts that flip 
images on their sides or upside down or anything.  I was wondering if you 
knew of any. 
                                        Jacob
FromMe
ToJacob Brackett
SubjectRe: turning and image on one of four random sides and displaying the image.
Date22 March 2006 20:02
Jacob,

> I can't seem to find any scripts that flip images on their sides or upside
> down or anything.  I was wondering if you knew of any.

JavaScript itself does not provide any way to do this, and neither does
HTML. Images can only be displayed as they naturally are.

Canvas allows something like this, but this is only supported on Opera 9 and
Firefox 1.5 (Safari 1.3+ also supports it, but generally has problems with
everything). Internet Explorer's filters may also offer something but they
suck, and they are non-standard and incompatible.

In general, you would be better off using a server side script to generate
new images in their rotated position, and display them. There are unix
command line image processors for doing this. The GD library has direct
integration from PHP, assuming your host support them:
http://www.php.net/gd


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.