Open GoogleCodeExporter opened 9 years ago
Sorry, I entered this as a defect rather than an enhancement... oops...
So, last night I got to thinking... and, rather than have the zc parameter have
yet another specific value to do something special (in my case, 4) I decided to
modify it a bit. Update attached.
1) Now it detects if zc was specified as a percentage. 0% does no
scaling--just crops to the specified dimensions. 100% scales completely to the
new dimensions ... maybe that seems backwards... maybe 100% should leave the
image at 100% size (no scaling) and 0% could be the new dimensions...!? I
dunno... you can decide what makes sense if you want to implement this. And,
of course, anything between 0% - 100% can be specified. ... in my case I
wanted to zoom in slightly and crop around a specific area of the image.
2) Also, since the zoom % changes how much of the original image fits within
the new dimension, my change to allow for specification of the top-left
coordinate for the alignment wasn't working quite right for me. So I made
coordinate-specified alignment represent the center location--where the
zoom/crop should focus.
Original comment by kory.pau...@gmail.com
on 24 Feb 2011 at 7:21
Attachments:
ok ok ok ...
The
- alignment switch-block bugfix for r130; and
- the new, alignment-specified-as-coordinates feature
are still in there...
But the zoom implementation from my last post was pretty awkward!
Now:
1) zc that is specified as a % just resizes the source image--100% means no scaling, 200% makes the source image twice as big, 50% half... etc. Crop position is determined by new height & width and alignment. Ex (zooms out to 80% the original size and focuses the center of the new image on pixel 100x50 of the original image):
?src=[img]&w=200&h=150&zc=80%&a=100,50
2) I also made it so zc can be specified as width X height, which just specifies the size of the source rectangle that will be squezed/expanded into the new width & height. Ex (stretches & zooms in on a 20x20 block at the bottom-right of the image):
?src=[img]&w=200&h=100&zc=20x20&a=br
- Kory
Original comment by kory.pau...@gmail.com
on 4 Mar 2011 at 3:07
Attachments:
oh... merged with r131!
Original comment by kory.pau...@gmail.com
on 4 Mar 2011 at 3:35
Attachments:
Here's an example of the alignment switch-block bug I mentioned in #3 of my 1st
post and bullet #1 of my 3rd post...
This should align to the bottom-right but it only aligns to the bottom because
the switch breaks before it gets to the block with the $src_x definition:
http://www.binarymoon.co.uk/demo/timthumb-basic/timthumb.php?src=castle1.jpg&w=1
00&h=200&a=br
Original comment by kory.pau...@gmail.com
on 4 Mar 2011 at 3:40
very handy mods there, thank you very much
Original comment by dziki...@gmail.com
on 25 Aug 2011 at 10:23
Hi,
How can i make timthumb to crop by top 100px? (left, right, bottom...?)
Original comment by amthucgi...@gmail.com
on 17 May 2013 at 6:45
Original issue reported on code.google.com by
kory.pau...@gmail.com
on 24 Feb 2011 at 1:58Attachments: