This script is so awsome!! Light weight, yet effective. The only problem is, that it only works with divs, as far as I can tell. I really need it to work with images. I tried substituting the divs with an img like this
But it doesn't work as soon as I put in the src. Is there a way to make images resizable? Thanks.
2) Angus TurnbullGroup: Moderators Posts: 4235Joined: 7 Dec 2003Location: New ZealandIP: 203.173.--.--
Posted:
Hmm! By default the script attempts to put resize handles inside the element, which won't work at all with images.
If you want resizability you could wrap the IMG in a DIV. Otherwise, if you edit the core script and delete the functions at the bottom relating to resize (either that or add a test for IMG tags that returns if found) you might have better luck!
Cheers - Angus.
3) MikeGroup: Guests IP: 68.6.--.--
Posted:
Oh ok. I was hoping was just missing something. Oh well, I'll mess with it. Also, I noticed that someone requested an option to maintain the aspect ratio of one of the four corners were used to resize. Did you ever configure this script to do that? That would be handy too.
4) Angus TurnbullGroup: Moderators Posts: 4235Joined: 7 Dec 2003Location: New ZealandIP: 203.173.--.--
Posted:
Got your email too! Will look into this. Would require a fair redesign of the drag mechanism.
Never added aspect ratio dragging, but that would be an easier addition.
- Angus.
5) sivth98Group: Members Posts: 1Joined: 4 Sep 2007Location: IP: 61.12.--.--
Posted:
Hi Angus,
Can you please send me the code for image resize or is that thing anywhere avaliable for download. Or assist me to rewrite the code.
-Siva
6) Angus TurnbullGroup: Moderators Posts: 4235Joined: 7 Dec 2003Location: New ZealandIP: 203.173.--.--
Posted:
The above conversation came to nothing sadly. However, if you don't care about wrapping your images in a div, you could very easily do:
That'll allow for a resizing image within a DIV. The reason the script doesn't easily resize an IMG element on its own is that it creates resize handles *within* the dragged element (using CSS for positioning) and IMGs can't have child elements.
Good luck - Angus.
7) Rich KuceraGroup: Guests IP: 206.241.--.--
Posted:
Here's a blurb that will grab all the images, test for those over 400 pixel width, then wrap them in the required DIV for dragresize... (I depended on prototypejs, I don't know how to accomplish it with just twinhelix stuff). I experimented with cloneNode but found I didn't need it, you can just reassign to another parent apparently.
Twinhelix Dragresize was easiest to approach and lightweight, but now am considering the Ext JS component (also the fact that prototypejs may be raising some conflicts with the enterprise wiki I'm testing (Confluence)).
It does exhibit some "funkyness" when you get to the original size of the div and are dragging from one of the corner handles, although it is fit for the purpose i need. If anyone manages to fix this however i would be interested to know.
Code in the next post (hopefully)
Thanks
Dave
www.djbwebs.com
10) DJB31stGroup: Members Posts: 2Joined: 30 Mar 2008Location: CyprusIP: 87.228.--.--
Posted:
DragResize.prototype.resizeHandleDrag = function(diffX, diffY) { with (this) { //ratio additions added by DJB31st for auto engraver preview script for OSC var ratio = elmW/elmH;
// Passed the mouse movement amounts. This function checks to see whether the // drag is from a resize handle created above; if so, it changes the stored // elm* dimensions and mOffX/Y.