+ Start a Discussion
Varghese KiranVarghese Kiran 

To compress image size while querying image from attachment

In my website I am querying more than 10 images from Attachments to show it in the page. Among these images, only one will be the main image and all others will be thumbnails. What I am doing right now is after querying the attachments, I have given specific size to the thumbnail and main image. This query generates more than 85% data of the site. Is there any way I can minimize the image size(by using code) or can I do anty modifications on the query so that I could reduce the site data. All suggestions are welcome.
Vishnu VaishnavVishnu Vaishnav
Hi Varghese,
You can use this trick to show images on page . it will not take data from query.
<apex:image url="/servlet/servlet.FileDownload?file={!attachment.id}" />
Varghese KiranVarghese Kiran
I am currently using it this way. the problem is not with the query, since I am showing more than 10 images using apex image, the page size becomes enormously large. It reaches upto 9 mb. Is there any way to reduce this size.
User-added image
Vishnu VaishnavVishnu Vaishnav
HI Varghese,
Your answer may be here :
https://wordpress.org/plugins/wp-smushit/developers/
http://www.smashingmagazine.com/2014/02/03/one-solution-to-responsive-images/
 
Vishnu VaishnavVishnu Vaishnav
HI Varghese,

I got a new link ,i think it will useful for u ..
http://bobbuzzard.blogspot.in/2014/11/responsive-images-in-visualforce.html
Varghese KiranVarghese Kiran
Hi Vishnu,

Thanks for your reply. 

I think, inorder to implement this using Picturefill, I should provide two different images. One for thumbnail and other for main image.Since there are so many images in my instance, it is not a feasible solution to created low sized images for all images.