Permlink Replies: 22 - Pages: 2 [ 1 2 | Next ] - Last Post: 09-May-2007 22:10 Last Post By: GeeVee Threads: [ Previous | Next ]
Cyril Rey
PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 04-Jan-2004 00:08
  Click to reply to this thread Reply
There is a script for preloading the next slide's image. Just add the code below in you slide template page. The best place is before the </body> tag but you can place it where you want.

<!---preload next image------------------------------------------------
<ja:if exists="next">			
	<SCRIPT LANGUAGE="JavaScript">
		next_image = new Image();
		next_image.src = "<%= next.get("fileName")%>";
	</script>
</ja:if>


This script is very useful for slide show, but also for every gallery.

During we are watching an image, the next image of the gallery is
preloaded in the browser proxy memory.

The main advantage is that the
loading time is masked by the watching time. Then when we switch to
the next image, the next image appears directly.

Try It
mark

Posts: 10
Registered: 3-Jun-2003
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 05-Jan-2004 13:12   in response to: Cyril Rey in response to: Cyril Rey
  Click to reply to this thread Reply
Nice one Cyril,

I added it to the development version of the ExhibitPlus skin. Just a couple of point to note there - you didn't close your comment with a --> so potentially there should be an open comment. I also replaced:

<SCRIPT LANGUAGE="JavaScript">


with

<script type="text/javascript">


This way the page can validate as strict HTML4.01

Mark
roshangupta

Posts: 3
Registered: 29-Jan-2003
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 07-Jan-2004 02:17   in response to: mark in response to: mark
  Click to reply to this thread Reply
Great idea, I just added it to my skin :-)
Rey Cyril
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 12-Jan-2004 22:44   in response to: mark in response to: mark
  Click to reply to this thread Reply
Tank you Mark and Roshangupta for you reply.

I recently post my album for testing this script in online condition. It work really very well.
It is particularly good for online-slide show.

You can try it on my web site : www.crl.ch/photos

Cyril
kaya

Posts: 72
Registered: 19-Jun-2003
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 13-Jan-2004 00:17   in response to: Rey Cyril in response to: Rey Cyril
  Click to reply to this thread Reply
Yes good idea but it seems that it doesn't work on your survival page.
next_image.src is _always_ empty (even if there exists a next photo):

<SCRIPT language=JavaScript>
  next_image = new Image();
  next_image.src = "";
</SCRIPT>


I tested your friends page (2004) where it works correctly though.
Bluebonnet

Posts: 5
Registered: 25-Jan-2004
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 05-Feb-2004 13:00   in response to: kaya in response to: kaya
  Click to reply to this thread Reply
It looks like a really good idea! I've heard about that image preload script before at Javascript sites. When I looked at Nouvel An 2004, it was great. Each picture popped up instead of me watching it download pixel by pixel on 56K. I guess it's a feature that wouldn't matter to people with DSL.

I just tried it on a folder of my files, and it prints out correctly and didn't seem to cause any problem. Maybe some of yours didn't work, as kaya said, because the comment was open in the code. Thanks for the tip. :)
PhotoGuy

Posts: 16
Registered: 14-Jul-2003
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 06-Feb-2004 08:25   in response to: Bluebonnet in response to: Bluebonnet
  Click to reply to this thread Reply
Guys,

Just added this feature to BPP v2.3 (development version) here and just uploaded a sample album to the following address (the prefetching is ON):
http://photos.armondavanes.com/

But can't experience any extra speed getting the next and previous slides! It's the same.... Seems the browser has not cahced the siblings although the JS code is there for each slide (you can check it)...

Any idea? Am I missing anything here?

Cheers,
Armond
Bluebonnet

Posts: 5
Registered: 25-Jan-2004
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 07-Feb-2004 05:40   in response to: PhotoGuy in response to: PhotoGuy
  Click to reply to this thread Reply
I looked at section 2 Sky in Experimental, and I don't see the code printed on your HTML pages. I just made a small album with your latest version of Blue++. Here is the javascript I added to the slide.htt:

	<script language="javascript" type="text/javascript">pageSetup();</script>
 
 	<!-- preload next image -->
	<ja:if exists="next">                   
        	<script language="JavaScript" type="text/javascript">
                	next_image = new Image();
                	next_image.src = "<%= next.get("fileName")%>";
        	</script>
	</ja:if>
 
</body>
</html>

And here is the code I got on the generated HTML of a slide page made with v2.2:

<script language="javascript" type="text/javascript">pageSetup();</script>
 
 	<!-- preload next image -->
	                   
        	<script language="JavaScript" type="text/javascript">
                	next_image = new Image();
                	next_image.src = "rap61.jpg";
        	</script>
</body>
</html>

The next _image.src was correctly generated for each slide, except the last one, of course. Your code didn't look the same as the above, if it was the nextimagepreload script in the head. When I went to the French site, I could hear my browser clicking as it loaded the next page in the background. I didn't hear that with your page, so that implies it wasn't preloading. It wasn't excessively slow in any case, but apparently it didn't preload.

PhotoGuy

Posts: 16
Registered: 14-Jul-2003
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 10-Feb-2004 09:01   in response to: Bluebonnet in response to: Bluebonnet
  Click to reply to this thread Reply
Thanks for the tip :-) I fixed it!
And now it's working... Just re-uploaded the entire album. Please take a look at the album once again and let me know if there are still any flaws.

Many thanks :-)

Armond
Bluebonnet

Posts: 5
Registered: 25-Jan-2004
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 10-Feb-2004 10:10   in response to: PhotoGuy in response to: PhotoGuy
  Click to reply to this thread Reply
Your pages look great on my 56K iBook (it reminded me that I haven't really looked at the sky in awhile). I saw the references to preloadnextimage near the top of the page, and the src for the upcoming page was there. It's a great feature, for sure. The next picture just pops up.

I was thinking about putting it in the Blue++ I already made, but I notice your code is quite different from just tacking it on near the end of the body. Since Blu++ has such complicated code anyway, maybe I should just wait for the next version. I'd hate to find out that the tack-on method means only a few browsers can read it correctly.

Many thanks for your skin. I was planning to lay out all those photo pages by hand when I came across JAlbum and your skin. It's a fine style. :)
PhotoGuy

Posts: 16
Registered: 14-Jul-2003
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 10-Feb-2004 14:47   in response to: Bluebonnet in response to: Bluebonnet
  Click to reply to this thread Reply
Thanks for all your kind words...
If you and other guys are needing this feature, I can try to come up with a quick version (but definitely with less features and bug fixes) so that you can have it pretty soon!

Regards,
Armond
Bluebonnet

Posts: 5
Registered: 25-Jan-2004
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 11-Feb-2004 09:15   in response to: PhotoGuy in response to: PhotoGuy
  Click to reply to this thread Reply
I hate to rush on projects myself, so don't overwork on my account. I was just noticing that you weave it into the rest of your extensive code rather than tack it on. I'm very happy with the style of the pages, whether they're fast or slow. Anything's better than tables of pictures with blue underlined Next and Previous links. :)
ONE HUMAN

Posts: 2
Registered: 24-Jan-2004
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 18-Feb-2004 01:39   in response to: PhotoGuy in response to: PhotoGuy
  Click to reply to this thread Reply
I implemented this PRELOAD feature on my new album, and it works great on a DSL connection, but it didn't help with a slideshow problem that I've discovered when using dial-up with the BluPlusPlus v2.2 skin.

I've set up an album using the BluPlusPlus skin with images that are about 50-70 KB. I've set the slideshow timer to 5 seconds. I tested it with a 56k dial-up connection, and the problem is that the slideshow moves to the next slide before the current image has completely downloaded.

It doesn't matter whether I add this PRELOAD feature or not, because 5 seconds isn't long enough to download 60 KB images on dial-up. The PRELOAD script does work, but on dial-up with the BluPlusPlus slideshow it doesn't get the chance to fetch the next image because it's too busy downloading the current image.

The problem isn't with the PRELOAD feature, but with how the BluPlusPlus slideshow is set up. Unfortunately, the slideshow timer begins counting immediately, instead of once the page has completely loaded with the entire image being displayed. I recommend that it be changed so that the counter doesn't start until the page has completely loaded.

Thanks for the PRELOAD script. Thanks also to Armond for the BluPlusPlus skin. Just wanted to let you know what's going on so that you can improve BluPlusPlus.
PhotoGuy

Posts: 16
Registered: 14-Jul-2003
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 20-Feb-2004 14:27   in response to: ONE HUMAN in response to: ONE HUMAN
  Click to reply to this thread Reply
Good point mate!

But I'm not a JavaScript guru... How can I force the slideshow counting to start "after" the whole slide with all the images got downloaded?

Anyone any idea?

Regards,
Armond
camner

Posts: 17
Registered: 24-Sep-2003
Re: PRELOAD NEXT IMAGE --> make your album faster...!
Posted: 21-Feb-2004 02:27   in response to: PhotoGuy in response to: PhotoGuy
  Click to reply to this thread Reply
There is an onload() javascript function that gets triggered after a page is completely loaded. The slideshow countdown routine could be called from the onload() function. I don't remember exactly where one puts the onload function, but I believe it's before the body section.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums