3 Replies - 11655 Views - Last Post: 06 January 2012 - 06:39 PM

#1 lemonchicken  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 76
  • Joined: 11-December 10

Loading an image from database (5/10)

Posted 06 January 2012 - 01:31 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.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


Is This A Good Question/Topic? 0
  • +

Replies To: Loading an image from database (5/10)

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6078
  • View blog
  • Posts: 23,548
  • Joined: 23-August 08

Re: Loading an image from database (5/10)

Posted 06 January 2012 - 01:56 PM

Moved to Post a Job
Was This Post Helpful? 0
  • +
  • -

#3 lemonchicken  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 76
  • Joined: 11-December 10

Re: Loading an image from database (5/10)

Posted 06 January 2012 - 02:05 PM

ah! thanks!!
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10663
  • View blog
  • Posts: 39,597
  • Joined: 27-December 08

Re: Loading an image from database (5/10)

Posted 06 January 2012 - 06:39 PM

Given that this is for your website which violates the copyrights on the wallpapers, I'm going to close this thread.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1