I'm using the great dd.dragdrop Library for many parts of the page, including loading in a user selected image via the "swapImage( )" function.
[CODE=javascript]
var imgRe = /^.+\.(jpg|jpeg| gif|png)$/i;
function swapMe(pathFiel d, previewName)
{
var path = pathField.value ;
if (path.search(im gRe) != -1)
{
dd.elements.rep laceMe.swapImag e('file://'+path) ;
}
else
{
alert("JPG, PNG, and GIFs only!");
}
}
[/CODE]
All works, but ...
The incoming image inherits the size and aspect ratio of the 'image' used to hold a place for it as required by the library.
<IMG Name="replaceMe " SRC="blank.gif" width="630" Height="730"><B R>
I have no control over the actual size of the user's image, although it will be within a moderate range of 630w x 730h.
Part of the use requires sizing to fit a measuring device. I would prefer to use SCALABLE, but because of the inheritance of the holder's height/width, the user has to H and V size independently with RESIZABLE.
Query: Is there an easy manner to get the incoming image to retain its aspect ratio - even IF it needs a greater/lesser SCALABLE adjustment?
Thanks,
[CODE=javascript]
var imgRe = /^.+\.(jpg|jpeg| gif|png)$/i;
function swapMe(pathFiel d, previewName)
{
var path = pathField.value ;
if (path.search(im gRe) != -1)
{
dd.elements.rep laceMe.swapImag e('file://'+path) ;
}
else
{
alert("JPG, PNG, and GIFs only!");
}
}
[/CODE]
All works, but ...
The incoming image inherits the size and aspect ratio of the 'image' used to hold a place for it as required by the library.
<IMG Name="replaceMe " SRC="blank.gif" width="630" Height="730"><B R>
I have no control over the actual size of the user's image, although it will be within a moderate range of 630w x 730h.
Part of the use requires sizing to fit a measuring device. I would prefer to use SCALABLE, but because of the inheritance of the holder's height/width, the user has to H and V size independently with RESIZABLE.
Query: Is there an easy manner to get the incoming image to retain its aspect ratio - even IF it needs a greater/lesser SCALABLE adjustment?
Thanks,
Comment