Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Addons

Post Reply
 
Thread Tools
  #21  
Old 12-01-2005, 01:29 PM
Paul Wood's Avatar
Paul Wood Offline
pixelpost guru
 
Join Date: May 2005
Location: Slidell, Louisiana, USA
Posts: 154
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);



?>

Last edited by Paul Wood; 12-02-2005 at 12:44 PM.
Reply With Quote
  #22  
Old 12-01-2005, 01:58 PM
tinyblob's Avatar
tinyblob Offline
team pixelpost
 
Join Date: Nov 2005
Location: scotland
Posts: 523
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.
__________________
touchnothing.net
Reply With Quote
  #23  
Old 12-01-2005, 02:07 PM
Paul Wood's Avatar
Paul Wood Offline
pixelpost guru
 
Join Date: May 2005
Location: Slidell, Louisiana, USA
Posts: 154
Quote:
Originally Posted by tinyblob
Paul, that's wayyy over complicated. Good job though!
Thanks -- it was cobbled together from other scripts, since I don't really know what I'm doing.

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.
Reply With Quote
  #24  
Old 12-01-2005, 02:13 PM
tinyblob's Avatar
tinyblob Offline
team pixelpost
 
Join Date: Nov 2005
Location: scotland
Posts: 523
okay
__________________
touchnothing.net
Reply With Quote
  #25  
Old 12-01-2005, 10:51 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
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
Reply With Quote
  #26  
Old 12-01-2005, 11:03 PM
Paul Wood's Avatar
Paul Wood Offline
pixelpost guru
 
Join Date: May 2005
Location: Slidell, Louisiana, USA
Posts: 154
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.

Last edited by Paul Wood; 12-02-2005 at 06:54 PM.
Reply With Quote
  #27  
Old 12-01-2005, 11:07 PM
tinyblob's Avatar
tinyblob Offline
team pixelpost
 
Join Date: Nov 2005
Location: scotland
Posts: 523
Quote:
Originally Posted by raminia
I'm not really a fan of pictures in signature and I think Blinking should ban this.
Harsh.

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.
__________________
touchnothing.net
Reply With Quote
  #28  
Old 12-02-2005, 09:15 AM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
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!
Reply With Quote
  #29  
Old 12-02-2005, 09:19 AM
tinyblob's Avatar
tinyblob Offline
team pixelpost
 
Join Date: Nov 2005
Location: scotland
Posts: 523
Well you can enter an url for your avatar - try it!
__________________
touchnothing.net
Reply With Quote
  #30  
Old 12-02-2005, 09:20 AM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
Quote:
Originally Posted by tinyblob
Well you can enter an url for your avatar - try it!
when i get home.
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 06:43 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs