View Single Post
Old February 14th, 2007, 09:03 AM   #1 (permalink)
Luciano
Registered User
 
Join Date: Aug 2005
Posts: 1,229
bug and fix in editimage

This only affects GD2 users
I didnt find the "troubleshooting" forum so i thought i'd post it here... sorry if i'm wrong.

somehow the "rotate image" did not really work in my 2.1 version downloaded last week. so I looked at the code..

the rotation is done by following in GD2:

$tempimage = @imagerotate($tempimage, $angle, '#000000');

in php 5.20 it somehow flips the pic by 90 degres and only sqeezes the content without rotating (tried several times)

so i looked up in php.net and found following:

resource imagerotate ( resource source_image, float angle, int bgd_color [, int ignore_transparent] )

as for what i know.. the background color i a int and not a string.. so the code should be:
$tempimage = @imagerotate($tempimage, $angle, 0);

i tried that.. and... it started working.. ( i do not know if in former editions of php it used to be a hex string.. but in 5.20 and 5.21 it definetly is an int.

so to fix: open forum/includes/functions_gallery_imageedit.php
find:
Code:
Content visible to verified customers only.
and replace with:
Code:
Content visible to verified customers only.
at least it worked for me

----------
thoughts: Make rotate image to rotate clockwise

A little confusing for users (and for myself) the default direction of imageRotate() is counter clockwise.

On php.net I found a little code snippet that solves the problem and sets the rotation direction to clockwise:

after having applied the fix above, find in forum/includes/functions_gallery_imageedit.php

Code:
Content visible to verified customers only.
and replace with:
Code:
Content visible to verified customers only.
hope this helps
Luc

Last edited by Luciano; February 20th, 2007 at 08:14 AM.
Luciano is offline