I run a pixelpost photoblog and would like to prefetch the next image from the database.
How it works: the user is given a random image at first page view and this image is hyperlinked to another random image.
What I would like: for the next image to load silently (hidden) for instant loading on the next page.
here is the addon that generates the next page link:
<?php
$addon_name = "Random Image ";
$addon_description = "This addon will enables the tag <IMAGE_RANDOM>
which is the ID of a random image of your Pixelpost photoblog. Using this ID, you can link to a random image easily.
Usage:<br>
<a href='index.php?showimage=<IMAGE_RANDOM>' > Random photo </a> <br>
The above tag links to your photoblog with a random photo.";
$addon_version = "0.3";
// Get the number of thumbnails shown at once from the admin config
$cfgquery = mysql_query("select * from ".$pixelpost_db_prefix."config");
$cfgrow = mysql_fetch_array($cfgquery);
//---------------------------
$thmb_numb_r = 1 ;
if (isset($image_id)){
$thumbs_ahead = mysql_query("select DISTINCT id,headline,image from ".$pixelpost_db_prefix."pixelpost where id!=".$image_id." and datetime<='$cdate' order by rand() asc limit 0,$thmb_numb_r");
}
else{
$thumbs_ahead = mysql_query("select DISTINCT id,headline,image from ".$pixelpost_db_prefix."pixelpost where datetime<='$cdate' order by rand() asc limit 0,$thmb_numb_r");
}
if (list($id,$headline,$image) = mysql_fetch_row($thumbs_ahead)) {
$rnd_img_id = $id;
}
$tpl = ereg_replace("<IMAGE_RANDOM>",$rnd_img_id,$tpl);
?>
and the index.php
http://pastebin.com/wBS8VqaN
Ideally it would work as an addon generating a tag such as <NEXT_IMAGE> so the image.jpg can be added in a hidden iframe (or a better way if you can think of one).
..but I think it would need to work as part of the random image addon in order for the image.jpg to be the same as the next page link..
£5 paypal (£10 if necessary) to whoever can get this working for me as I have no idea how to code this!
thanks in advance
Alex
This post has been edited by lemonchicken: 06 January 2012 - 02:07 PM

New Topic/Question
This topic is locked



MultiQuote








|