Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>I agree with @Jason Dean,</strong> <em>But If you want to detect it by using JavaScript I would do like so: When getting the thumbnail I would attach some kind of id/class property to it and check if it's present.</em></p> <p>Check if id of "img-tumb" exists:</p> <pre><code>var imgThumb = document.getElementById("img-thumb"); if (imgThumb != null){ alert("Thumbnail exists"); }else{ //Check Image size... </code></pre> <p>Now to check the image size:(Placed after else of last if)</p> <pre><code>var img = document.getElementById('your_image_id'); var height = img.clientHeight; var width = img.clientWidth; </code></pre> <p>To change the height after the image height was detected:</p> <pre><code>img.style.height = height-50;//Substracks 50 pixles from the original size img.style.width = width-50;//Substracks 50 pixles from the original size </code></pre> <p>For you finale event(when none are detected), I would use the same checking as in phase one.</p> <p><strong>Complete code:</strong></p> <pre><code> var imgThumb = document.getElementById("img-thumb"); var imgFull = document.getElementById("img-full");//Full sized image if (imgThumb != null){ alert("Thumbnail exists"); }else if(imgFull != null){ //Check Image size... alert("Full sized image exists"); var img = document.getElementById('your_image_id'); var height = img.clientHeight; var width = img.clientWidth; img.style.height = height-50;//Substracks 50 pixles from the original size img.style.width = width-50;//Substracks 50 pixles from the original size }else{ //Place noimage.gif } </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