PDA

View Full Version : 12CropImage


Joris
04-19-2005, 02:49 PM
There were two things I didn't like about 12CropImage as it came:
- the square couldn't get bigger than the width of the image (good), but it could get bigger then the height of the image (or it was the other way around);
- the square couldn't get as small as my thumbnails (while I guess this is to minimize quality loss by re-compression, I've set quality so low already that it doesn't really matter to me)

I thought maybe somebody would be interested to know how to change this.
- in 12cropimageinc.php I set $imgProp = 1; (instead of 0.4 or so)
- in 12cropimageincscript.php I changed the first rimg.cr-2 of the last else statement to rimg.cr and the second rimg.cr-2 to rimg.cb:
old:
else {
if ((obj.cr < (rimg.cr-2))&&
(obj.cb < (rimg.cr-2))
){
cW = obj.cr + 1;
cH = parseInt(prop * cW);
obj.clipTo(0,cW,cH,0,1);
}
}new:
else {
if ((obj.cr < (rimg.cr))&&
(obj.cb < (rimg.cb))
){
cW = obj.cr + 1;
cH = parseInt(prop * cW);
obj.clipTo(0,cW,cH,0,1);
}
}
Works for me with Mozilla Firefox 1.0.2-1.0.3 (with TBE) and with Internet Explorer 6 on Windows XP SP2 (talking about the javascript of course).

If there are any (other) reasons not to do this please let me know.