1

I have a series of image which in display in a HTML page.

Some images are 150DPI some are 300DPI

The 150 DPI image Fit the HTML page the, 300 DPI image go out of page so i use Jquery to resize the image

$('#questionTable img').each(function() {

        var width = $(this).width();
        var height = $(this).height();

        if(width> 1000)
        {
            $(this).width(function(i,w){ return w*0.6});
            $(this).height(function(i,h){ return h*0.6});
        }   
    });

The issue is i am resizing based on width is there a way to resize only 300 DPI images ?

Naveen Kumar
  • 4,543
  • 1
  • 18
  • 36
  • Possible helpfull link: http://stackoverflow.com/questions/13560017/how-to-check-image-quality – Ron van der Heijden Aug 21 '13 at 11:18
  • html does not have such a thing as dots per inch. images have an amount of pixels which fit in a box with the same amount of pixels or the image gets cropped. – Joel Harkes Aug 21 '13 at 11:18
  • You should be able to do the above without using any scripts i'd say. – techfoobar Aug 21 '13 at 11:18
  • yes why doint you set 'width:100%' – Anant Dabhi Aug 21 '13 at 11:19
  • Width: 100% will not work , i want to display in page not blow to the width of the page – Naveen Kumar Aug 21 '13 at 11:27
  • I would really suggest to adjust css to take care such a problems. Give `#questionTable` width in pixels if you like, but in order to make `img` same width no matter which version of image is present, you should keep `img` width in percentages. – Giedrius Aug 21 '13 at 11:33
  • @techfoobar OK, I'll bite. How do you display a picture that is more than 1000 pixels wide at 60% of its size, without any script? – Mr Lister Aug 21 '13 at 11:44
  • @MrLister - Don't think we can display it in a percentage of its own size. However, we can redesign the interface so as to be able to display the image w.r.t. its parent which can have a fixed max-width or so. – techfoobar Aug 21 '13 at 11:51

0 Answers0