Advanced Search

Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Rotate an Image 90° or 180° ?

  1. #1
    Join Date
    Oct 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Rotate an Image 90° or 180° ?

    I'm looking around for any script that will take a .jpg or .gif image and turn it
    (rotate it) 90 or 180° by single-clicking on the image.

    Does such code exist that can be included in the <img src. . . > tag itself
    Like <img src="myimage.jpg" onClick . . . > ?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,641
    Thanks
    42
    Thanked 2,897 Times in 2,869 Posts
    Blog Entries
    12

    Default

    Not really. This:

    http://www.walterzorn.com/rotate_img/rotate_img.htm

    perhaps comes closest. Be sure to read the warnings.

    Something like that might be able to be worked out in Flash. But it wouldn't be an onclick event of the img tag, it could probably be an onclick event of the Flash object. But, I'm not 100% sure this can be done in Flash either, just that it might be possible.

    On the other hand, if you already had the 90 and 180 degree views as separate image files, a simple image swap could be done onclick in javascript.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    11,833
    Thanks
    233
    Thanked 659 Times in 647 Posts

    Default

    You could play with negative height/widths
    Daniel - Freelance Web Design | <?php?> | <html>| Deutsch | italiano | español | português | català | un peu de français | Ninasoma Kiswahili | 日本語の学生でした。| درست العربية

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,641
    Thanks
    42
    Thanked 2,897 Times in 2,869 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by djr33 View Post
    You could play with negative height/widths
    Are you serious? The smiley would seem to indicate, no.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    11,833
    Thanks
    233
    Thanked 659 Times in 647 Posts

    Default

    Hey, it works logically and in programs like photoshop. I seriously doubt it would work in browsers, though, (I haven't tried it), and certainly wouldn't be reliable. But might be fun! Now I must try it.


    Edit: Conclusion: nevermind. The best you can do is get the image to not display at all using a negative width. Height seems to do nothing. How sad. I protest!!! HTML 5 SHALL INCLUDE THIS I SAY! (Don't mind me, I'll be on my way now...)
    Last edited by djr33; 12-16-2007 at 04:14 PM.
    Daniel - Freelance Web Design | <?php?> | <html>| Deutsch | italiano | español | português | català | un peu de français | Ninasoma Kiswahili | 日本語の学生でした。| درست العربية

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,484
    Thanks
    4
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    You can do it in Flash, this I know. Which leads me to believe you can also do it with JS. Not sure exactly how at the moment, but perhaps I will work on something.

    Hmm.. off to ponder...
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,641
    Thanks
    42
    Thanked 2,897 Times in 2,869 Posts
    Blog Entries
    12

    Default

    If you can do it in Flash, I would think it would because of Flash's ability to manipulate images with minimal drain on the CPU is greater than javascript's. In javascript (as far as I know), the math involved would put even the fastest processor into a catatonic state.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,484
    Thanks
    4
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Well, no one said it would be easy.... LOL

    My meaning is that AS and JS are virtually the same. Coding in one is very similar to the other (but why I can master AS and not grasp JS is beyond me.. but I am trying to teach myself JS.. it's coming along...

    Perhaps there is a little trick to it we haven't thought of yet.. I may just uncover that... Yay me
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    11,833
    Thanks
    233
    Thanked 659 Times in 647 Posts

    Default

    Despite any similarities in the languages, the properties simply differ. There's no "movie clip" object in JS, as a basic example.

    However, I'm not fully convinced it isn't possible. I'd think that backwards or upside down would in fact be possible. But not odd angles (like 45 degrees)
    Daniel - Freelance Web Design | <?php?> | <html>| Deutsch | italiano | español | português | català | un peu de français | Ninasoma Kiswahili | 日本語の学生でした。| درست العربية

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    27,641
    Thanks
    42
    Thanked 2,897 Times in 2,869 Posts
    Blog Entries
    12

    Default

    There is an IE only way:

    Code:
    style="filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);"
    But this doesn't rotate in real time, just shows the image rotated 180 degrees (use rotation=1 for 90, 3 for 270). You can script this, but it would be an abrupt transition. Filters only work in IE 5.5 and up, this particular one may have come along later. They don't work in any other browsers.

    I seem to remember now a cross browser script that put a faded 'reflection' beneath an image, not sure though, I'll have a look for it.
    Last edited by jscheuer1; 12-16-2007 at 05:45 PM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •