PDA

View Full Version : Show latest image


silfver
09-25-2007, 09:41 PM
Hi!

I'm sorry if this has been up before, but I've tried to search for it...

I want to get my latest image from a link, just the image, not the whole site. Something like this:
index.php?showimage=latest

This is so I can place the fullsized image in another site. And it will shot me the img-file in the browser, not the whole site.

Do you guys understand what I mean?

Thanks for the help!

jaywilliams
09-26-2007, 12:38 AM
This addon should do the trick:
http://www.pixelpost.org/v1/index.php?x=downloads&details=80

silfver
09-26-2007, 07:17 AM
Yes, it works! But I want to show the fullsized image. How do I do that?

GeoS
09-26-2007, 08:07 AM
Check this out:
http://piotrgalas.com/projects/latestPhoto2/

silfver
09-26-2007, 10:13 AM
The thing is I want to post this link on my facebook. Så I can't post javascript and stuff. The only thing I can do is posta link to an image, and the link you gave me requires more than that...

GeoS
09-28-2007, 02:07 PM
If you have flashcrop addon then it makes always copy of oryginal image which it is processing and (if I good remember) its called tmpimage1.jpg.
So link you look like http://yourdomain.com/pathtopixelpost/images/tmpimage1.jpg

silfver
09-28-2007, 10:13 PM
I solved it on my own, with the folowing code:

<?php
header("content-type: image/jpeg");

mysql_connect("localhost","username","password")
or die("Could not connect: " . mysql_error());

mysql_select_db("database");

$result = mysql_query("SELECT image FROM pixelpost_pixelpost WHERE datetime < NOW() ORDER BY datetime DESC LIMIT 1") or die('Err: ' . mysql_error());

if(mysql_num_rows($result) > 0){

$data = mysql_fetch_array($result);
$picture = "images/" . $data['image'];
$imgInfo = Array();
$imgInfo = getimagesize($picture);
$pic = imagecreatetruecolor($imgInfo[0], $imgInfo[1]);
$picture = imagecreatefromjpeg($picture);
imagecopyresampled($pic, $picture, 0, 0, 0, 0, $imgInfo[0], $imgInfo[1], $imgInfo[0], $imgInfo[1]);
echo imagejpeg($pic);
imagedestroy($pic);

}

?> Now, if I go to, silfvercreations.com/photolog/latest-post.php my latest post will show.