...

View Full Version : Prefetching an image from database (5 paypal)



lemonchicken
01-05-2012, 10:23 PM
Hello,

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 &lt;IMAGE_RANDOM&gt;
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>
&lt;a href='index.php?showimage=&lt;IMAGE_RANDOM&gt;' &gt; Random photo &lt;/a&gt; <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 location.jpg can be added in a hidden iframe (or a better way if you can think of one).

I think it would need to work as part of the random image addon in order for the image ID to be the same as the next page link..

5 paypal to whoever can get this working for me

thanks in advance

Alex



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum