Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to Display a web image correctly in Javascript
    primarykey
    data
    text
    <p>This is screen shot of my web page, under Offer image, there's image displaying a web image.</p> <p><a href="http://imageshack.us/a/img684/9584/screenshot20120920at335.png" rel="nofollow">http://imageshack.us/a/img684/9584/screenshot20120920at335.png</a></p> <p>However, the actual web image is </p> <p><a href="http://imageshack.us/a/img717/5240/1348180361.png" rel="nofollow">http://imageshack.us/a/img717/5240/1348180361.png</a></p> <p>The code for that container is </p> <pre><code> $('#image_upload_form input').change(function() { success: function ( data ) { var jsonData=data; if(jsonData.status==1) { var imagePath="http://www.test.com/play2win_offerimages/" + jsonData.image_name; $('#offer_detail input[name=image]').val(imagePath); myImage = new Image(); myImage.src = imagePath; myImage.width=100; myImage.height=100; $(myImage).load(function() { $('#offer_image').updateimgto(myImage.src); }); } //status=1 } //success }); //submit </code></pre> <p>I set the image, myImage to 100x100. Yet as you can see from the webpage only a portion of the image is shown.</p> <p>Right now, my web image shown on page is cropped.. How to fix that?</p> <p>I do not want crop, only to rescale to fit in the container.</p> <p>html for image_upload_form</p> <pre><code> &lt;form id="image_upload_form" enctype="multipart/form-data" action="http://www.test.com/play2win_api/offers/upload_image" method="POST"&gt; &lt;input type="hidden" name="MAX_FILE_SIZE" value="8192000" /&gt; &lt;input name="offer_image" type="file" id="imagefile"/&gt;&lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload