andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.

Occasional broken cropped image

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Forum Index -> Crop Canvas
View previous topic :: View next topic  
Author Message

Joined: 05 Nov 2005
Posts: 10
Location: Austin, TX

PostPosted: Wed Dec 07, 2005 11:26 am    Post subject: Occasional broken cropped image Reply with quote

Hi there Andy, I've got one more for you Smile And this was only discovered yesterday... The guy I put this in for tried uploading a gif to crop, and when the crop came back with a broken image, I assumed that maybe his gd library was one of the versions that they had removed support for writing gif formats during the whole propriety-gif-format legal battle by Compuserve I believe... however, while running some tests on it this morning, I uploaded a screenshot in gif format, and it cropped with no problems... When I uploaded a button image which was only like 20x164px, the cropping square overlapped the borders of the image, because I had it set to a 75x75 default, and the crop was coming out as a broken image... I thought perhaps the cropping area breaking the boundaries of the image was what was causing that problem, so I put some code in place to use the minimum value of the image's total width, height, and 75px as the cropping area width and height (so it would be a square of 75x75 normally, but on this button for example, would only be 20x20)... That worked fine, but it's still giving me a broken image for the cropped area... when I examined the get variables in the url, I noticed that the sy variable was -2 if I moved the cropping square anywhere, so I put a js alert in there to echo the dd.elements.theCrop.y and dd.elements.theImage.y upon my_Submit(), and I noticed that it was showing theCrop.y as being 2 smaller than theImage.y, and so passing on -2 for that, and only if I moved it anywhere, otherwise it would pass a 0 for sy if the cropping area was left in the upper-lefthand corner... I thought maybe the -2 was causing the image to break, until I found that when it passed 0, it would also break... At this point I'm stumped... any ideas? Smile

Back to top
View user's profile Send private message Visit poster's website
Site Admin

Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Fri Dec 16, 2005 4:32 am    Post subject: Reply with quote

I think it may have something to do with the box model in CSS. When I made the interface I didn't really take that in to account, but the cropping div uses a border or 1px. This means that if you set the cropping size to be 75px then in IE the size of the div will be 75px, but in FF it'd be 77px (or vis-versa - it's too early for me to think!) So that'd account for the -2px you were getting. Try the cropping div without a border, or use one of the box model hacks to fix the problem and try again. Or try the same interface with the same settings in IE and FF and see if they both break.

Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Forum Index -> Crop Canvas All times are GMT - 5 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group