homepage Welcome to WebmasterWorld Guest from 54.227.215.140
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Site Graphics and Multimedia Design
Forum Library, Charter, Moderators: not2easy

Site Graphics and Multimedia Design Forum

    
Graphic Load Times in an iframe - any way to speed it up?
Small graphics in iframe are slow to load
cmendla

10+ Year Member



 
Msg#: 3491145 posted 5:07 am on Oct 30, 2007 (gmt 0)

I have a small PHP ad rotator running on my sites. The basic layout is that I have an I frame in my border. the PHP rotator swaps out pages into the iframe on a random basis.

Most of the ads have a small pic - about 150x150 or so and a small size.. ie less than 5 to 10k. They are all in a JPG format and probably would not look that great as gifs.

I noticed that it takes about 2-3 seconds for the picture to load. I was wondering if there wasn't any way of preloading the pictures. On average I might have about 20 pictures at most for a site.

I would think that there would be a php or javscript app out there that would load these somehow so they showed up faster.

I'd appreciate any ideas..

cg

 

thecoalman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3491145 posted 6:32 am on Oct 30, 2007 (gmt 0)

In your main page at the bottom:

<div style="visibility:hidden;">
<img src="http://www.yoursite.com/image1.jpg" alt="-">
<img src="http://www.yoursite.com/image2.jpg" alt="-">
<img src="http://www.yoursite.com/image3.jpg" alt="-">
</div>

That will cache them locally on the users machine so they do not have to be loaded again.

Note the alternate tag, I read in a accessibility page you should not use text like "hidden image" or "arrow" but instead use a symbol if possible. If for example the image is a arrow use > or -> Not sure what would be appropriate for things you want to hide.

On a side note 5-10k image shouldn't take that long to load even on a 56k modem. Might be the PHP script you are using is taking a long time to execute in which case the example I posted will not help.

cmendla

10+ Year Member



 
Msg#: 3491145 posted 10:16 am on Oct 30, 2007 (gmt 0)

Thecoalman

Thanks. I'll give that a try. I was looking at it more closely and noticed two things.

1. It does not currently appear to be caching the images. In other words, the load times are the same for the first and subsequent loads of the same image. I'll see if the code you provided changes things.

2. The long load times seem to only apply to images I'm hosting on my site. I use other images that are hosted on affiliate hosts. In other words, a book cover pic might be hosted at amazon. Those seem to load instantly. I can't figure why it would take longer to show a pic from the same site than one hosted on another site.

One last thing. Most of the traffic is search engine traffic where people come into one of the interior pages and not the home. The average number of pages visitied is about 5 or so per visit. I think I might need to try to write code using a cookie to cache the images the first time they visit a page but not on subsequent visits.

thanks
cg

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Site Graphics and Multimedia Design
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved