Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Image loading times View modes: 
User avatar
Member
Member
lwhittemore-emh - 2/1/2013 8:38:42 AM
   
Image loading times
What is the best method regarding load time for loading images on a page?

Currently in a document type I add a file using the direct upload option. My transformation will look something like this
<img src="<%# GetFileUrl("Image") %>" alt="<%# Eval("Alt") %>" />

Is there a way that will help the images load faster?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/1/2013 10:17:15 AM
   
RE:Image loading times
Where are you storing your images? Database? File system? Both? Here's a breakdown of what I learned on a webinar on images:

Load times for images
Content tree (CMS.File) = good
Attachments (document attachments) = good
Media Library = better
App_Themes = best

With that being said, loading from the file system is going to be your best and fastest option but not every case allows for file system only. You can opt to store files in the database, file system or both for files you upload through the UI. You can also restrict a max side which will take a 3600px x 2400px image and rescale it to the the max side value you set (say 1500px). This will also help for file sizes and load times.

Here's an example I have (sounds similar to yours) on a home page I have uploaded 4 images which are nested under it. In my repeater I have a transformation that has a simple <img> tag in it and it looks like this:
<img alt="<%# Eval("FileName") %>" src="<%# GetDocumentUrl() %>" />
This is using the standard CMS.File document type and I have no issues with 900px images

User avatar
Member
Member
lwhittemore-emh - 2/1/2013 12:49:05 PM
   
RE:Image loading times
I assume the images are being stored in the database not the file system. I do not know how to set it to store them in the file system. I guess I'll look into that. The files are always optimized for the web but when ever I load in image through a repeater it always seems slow.

Here is an example of a recent site we launched. The images all load slow.
http://www.inlandhospital.org/


User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/1/2013 1:29:50 PM
   
RE:Image loading times
First off, nice looking and functioning site! It did load very fast for me.

Secondly, you can check the settings in Site Manager>Settings>System>Files>Storage. Options are Store files in file system and/or database.

As I mentioned if you're using the CMS.File class, use the code I posted above, not to say what you posted won't but this has less calls than your code so it might help improve performance. GetDocumentUrl() is part of the class so no extra leg work is needed. You might check out the help for methods in transformations for additional info. In particular the Images section.

If you have your own document type and created a Media Selector field for the images then all you'd have to do is post the value of that field as it stores the actual URL in the field.