PhotoPlog

PhotoPlog (http://www.photoplog.com/forum/index.php)
-   "How Do I..." Questions (http://www.photoplog.com/forum/forumdisplay.php?f=7)
-   -   Index Thumbs (http://www.photoplog.com/forum/showthread.php?t=10)

Tefra 12-31-2005 05:02 PM

hey Morgan can you help me a little i want to add a random thumb on my index with some small info views , comments and author , the problem is that the rest of the site it isn't intergrated with vbulletin so i need some general code to work it out

Morgan 12-31-2005 09:12 PM

Here is an example showing how to call a thumb on a non-vB PHP page. Tweak as needed.
Code:

$photoplog_location = "http://www.3dacc.net/gallery";
$photoplog_imgdir = "images";
$photoplog_imgsize = "small";

$connect = mysql_connect("localhost", "username", "password");
$select = mysql_select_db("database");

$query = "SELECT * FROM photoplog_fileuploads WHERE moderate = 0 LIMIT 1";
$result = mysql_query($query, $connect);

$image = '';

if ($row = mysql_fetch_object($result))
{
    $image = "
        <a href=\"".$photoplog_location."/index.php?n=".$row->fileid."\">
            <img src=\"".$photoplog_location."/".$photoplog_imgdir."/".$row->userid."/".$photoplog_imgsize."/".$row->filename."\" border=\"0\" />
        </a>
    ";
}

mysql_free_result($result);

echo $image;


Tefra 12-31-2005 09:56 PM

thanks , it's exactly what i wanted

starmagh 10-05-2008 10:45 AM

thanks Morgan
works great

Toups 11-01-2009 12:15 PM

This works for me, however the image does not seem to be random at all... any way to fix this?

Morgan 11-03-2009 03:31 PM

You'd need to add ORDER BY RAND() to the query but it is not recommended on large galleries.


All times are GMT. The time now is 09:40 PM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.