View Full Version : How to "Get latest image" on external site
dan1el
11-01-2005, 01:33 PM
Hi.
I would like to fetch the latest image and put on my website. I have the photoblog in /photoblog/ but I want the picture in the root.
Like this:
"Latest image in my photoblog:"
Perhaps thumbnail, title and the picture itself.
Is that possible?
dan1el
11-01-2005, 01:46 PM
I tried this:
<?php
require("./photoblog/includes/pixelpost.php");
require("./photoblog/includes/functions.php");
start_mysql();
$cdate = $datetime;
$row = sql_array("select * from ".$pixelpost_db_prefix."pixelpost where datetime<='$cdate' order by datetime DESC limit 0,1");
print $row['image'];
print '<img src="./photoblog/images/ '. $row['image'] .'"/>';
?>
No luck :(
dan1el
11-01-2005, 02:01 PM
Got it working.
Correct code:
<?php
require("./photoblog/includes/pixelpost.php");
require("./photoblog/includes/functions.php");
start_mysql();
if($cfgrow = sql_array("select * from ".$pixelpost_db_prefix."config")) { }
$tz = $cfgrow['timezone'];
$cdate = gmdate("Y-m-d H:i:s",time()+(3600 * $tz));
$row = sql_array("select * from ".$pixelpost_db_prefix."pixelpost where datetime<='$cdate' order by datetime DESC limit 0,1");
$image_title = pullout($row['headline']);
$image_datetime = $row['datetime'];
print '<div class="latestEntry"><h2>Latest image in the <a href="./photoblog/">photoblog</a>: «'. $image_title .'»</h2>';
print '<a href="./photoblog/"><img alt="Latest photoblog entry" src="./photoblog/images/'. $row['image'] .'"/></a></div>';
?>
Joe[y]
11-01-2005, 04:10 PM
well done
Connie
11-01-2005, 04:17 PM
dan1el,
it would be great if you would add this to the addons...
maybe with the path to the pixelpost-folder as variable
just an idea:
<?php
include("latestimagenotinblog.php?folder=path_to_pixelpost");
?>
what you think about that?
scooterphish
11-02-2005, 09:27 PM
what about-
Latest thumb on other pages - clean HTML no PHP (addon) (http://pixelpost.org/v1/index.php?x=downloads&details=80).
Hmm..nevermind...you were looking for the thumb, pic and title. The addon won't do that yet. but it does work for me (http://mylifeasafischer.com) on my sidebar :)
Yeah, I could've just cancelled this post, but I put so much effort in to looking up the addon :p
dan1el
11-03-2005, 11:47 AM
dan1el,
it would be great if you would add this to the addons...
maybe with the path to the pixelpost-folder as variable
just an idea:
<?php
include("latestimagenotinblog.php?folder=path_to_pixelpost");
?>
what you think about that?
I could, but im lazy. :)
I did this same thing using the RSS feed. I modified the photoblogs beta bookmarks add-on. That way there is no connecting to the pixelpost database from the external site.
That way there is no connecting to the pixelpost database from the external site.
And there shouldnt :D Try to put "service" script on server with PP and get by it all data which you need - its first step to web services.
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.