|
#21
|
||||
|
||||
|
I'm learning. This works to display the latest image, but I'd appreciate someone familiar with PHP and MySQL take a look at it and see if I need to add anything for proper coding.
Code:
<?php
/*
Based on code by Perpetual Dreamer and Alland.
Modified by Paul Wood, who knows nothing about PHP.
Portions of this code from scripts by tinyblob and Raminia
Instructions:
Put this file in your pixelpost root dir and link to the script as a php file. Can be used in a site, such as <img src="filename.php">,
or a forum, using [ img ]http://yoursite.com/filename.php[ /img ]
*/
require("includes/pixelpost.php");
function start_mysql()
{
global $pixelpost_db_host, $pixelpost_db_user, $pixelpost_db_pass, $pixelpost_db_pixelpost;
mysql_connect($pixelpost_db_host, $pixelpost_db_user, $pixelpost_db_pass) || die("Error: ". mysql_error());
mysql_select_db($pixelpost_db_pixelpost) || die("Error: ". mysql_error());
}
function pullout($str)
{
$str = stripslashes($str);
$str = UTF8_decode($str);
return $str;
}
start_mysql();
// get current time
$datetime = date("Y-m-d H:i:s");
$cdate = $datetime; // for future posting
// Get Current Image.
$query = mysql_query("select image,headline,datetime,id from ".$pixelpost_db_prefix."pixelpost where datetime<='$cdate' order by datetime DESC limit 0,1");
$row = mysql_fetch_array($query);
if(!$row['image']) {
echo "Coming Soon (query fail)!";
//exit;
}
$image_name = $row['image'];
$image_title = pullout($row['headline']);
$image_id = $row['id'];
$image_datetime = $row['datetime'];
// filename
$image_name = 'thumbnails/thumb_'.$image_name;
$imgSize = GetImageSize( $image_name );
//Display the image
header('Content-Type: image/jpeg');
header('Content-transfer-encoding: binary');
$img = imagecreatefromjpeg($image_name);
imagejpeg($img);
?>
__________________
Paul Wood Moments in Time After & Before a thousand words — the musings of a photographer Latest images: Last edited by Paul Wood; 12-02-2005 at 12:44 PM. |
|
#22
|
||||
|
||||
|
Paul, that's wayyy over complicated. Good job though!
My latest image: This isn't actually an addon to pixelpost, it's a standalone file that you just drop in your pixelpost folder: thumb.php To link to your thumbnails, just do it with normal image tags, but instead of linking to a .jpg you'd be linking to this .php file. Bear in mind that this file has to be in your pixelpost directory to function. I can update the addon version if anyone uses it, but this "external file" method will actually be faster. |
|
#23
|
||||
|
||||
|
Quote:
I have the date function in there because I don't want to display my future images as my latest image thumbnail. I try to post 4 or 5 days in advance in case I get too busy or forget.
__________________
Paul Wood Moments in Time After & Before a thousand words — the musings of a photographer Latest images: |
|
#24
|
||||
|
||||
|
okay
|
|
#25
|
||||
|
||||
|
I dont like this kind of signature.
I'm not really a fan of pictures in signature and I think Blinking should ban this. Dynamic ones are worst. In forum posts should have consistancy and these signatures will break that. sorry just a peronal opinion.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7 |
|
#26
|
||||
|
||||
|
I disagree. I think consistency lies with the avatar, and this is an excellent way to encourage people to visit your blog.
However, I'm not one to encourage rebellion, so I'll remove this sig from this forum. I really wanted it for my local theatre forum, anyway.
__________________
Paul Wood Moments in Time After & Before a thousand words — the musings of a photographer Latest images: Last edited by Paul Wood; 12-02-2005 at 06:54 PM. |
|
#27
|
||||
|
||||
|
Quote:
As a photographer i like being surrounded by photographs, both mine and other peoples. This is a forum for photobloggers, by photobloggers, about photoblogging software. Why don't photos have a place here? At 2-5KB they don't exactly slow the forum down, and i don't see why they're any less consistent than having a couple of lines of hyperlinks or whatever in your sig. I liked the idea because it let regular posters know when i've updated, not everyone uses RSS feeds. But i've removed it now. |
|
#28
|
||||
|
||||
|
meh - i have no problem at all with it! as long as people don't have 800px wide thumbs :P
though, would be cool if it could be used for forum avatars! my 80x80 thumbs would fit the bill just fine!
__________________
Affordable Website Design in North Wales |
|
#29
|
||||
|
||||
|
Well you can enter an url for your avatar - try it!
|
|
#30
|
||||
|
||||
|
Quote:
__________________
Affordable Website Design in North Wales |
| Post Reply |
| Thread Tools | |
|
|