PDA

View Full Version : extra page in blog


djaef
10-13-2006, 10:27 PM
I was wondering if there's any way with pixelpost to add a page (with photo) that doesn't show up in the blog. Huh? you say? Chromasia uses this technique a bit. Like today for example where I've posted a picture I've manipulated, and I'd like to have a link in my comments pop-up, linking to a page where the unmanipulated version would be. But I don't want that page accessible from the archive or showing up on the main page...

I hope you know what I mean.

Cheers

GeoS
10-13-2006, 11:26 PM
Create new file called photo_template.html in dir with your template. Then you can call it like http://your_address.com/index.php?x=photo

Whole idea is very simple. New stuff you can add to Pixelpost by making a file xyz_template.html in current template dir and access it from net via http://your.address.com/index.php?x=xyz.

RAitch
10-14-2006, 01:33 AM
You'd have to do a page for each image you wanted (assuming you'd be doing it more than once) so you'd have to think of a way to make that flexible.

You could whip together some quick PHP code that would build the image path using data from the link you specify... like http://your_address.com/index.php?x=photo&file=1234edit.jpg

Then you could pull out the file var and point to the file you're talking about on your host like http://your_address.com/images/1234edit.jpg


That would be pretty easy to do... wouldn't take much coding, and it would allow you to display any image that you choose.

Thanks for the idea... I think I'm going to do this myself.

RAitch
10-14-2006, 02:32 AM
Got it working... check out a sample here (just a desaturation of one of my images for a test)

http://www.richardhoutby.com/index.php?x=support_image&pic=BarnClouds.jpg&path=Files/

djaef
10-14-2006, 04:43 AM
Glad to help Richard :)

But php is 'pretty hard programming' to me, so I don't think that's really an option. Unfortunately I don't quite understand GeoS idea either. The first bit I think I get - just make a new template called whatever_template.html, based on image_template.

But how do I load the new picture into the whatever template, so that if I link to http://myaddress.com/blog/index.php?x=whatever there'll be a picture in there? And then if I wanted to do it again, I'd have to make another template - whatever_2 etc? Hmmm....

RAitch
10-14-2006, 05:15 AM
That's why I thought PHP would be easier.

Try this. Copy and paste this code into a new file called supporting_image.php and put it into your addons folder.


<?php
/*
Supporting Image
ADDON-Version 1.0

Written by: Richard Houtby
Contact: phpdev@richardhoutby.com
Written for: Pixelpost and adopting free software license

License: http://www.gnu.org/copyleft/gpl.html

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

$addon_name = "Supporting Image";
$addon_description = "Show an image based on address parameters.<br />
To use, add \"&pic=filename.jpg\" to your index.php link.<br />e.g. http://www.yourdomain.com/index.php?x=support_image&pic=123.jpg<br /><br />
If your image isn't in the images folder, specify the complete path using the \"path=\" parameter.<br />e.g. http://www.yourdomain.com/index.php?x=support_image&pic=123.jpg&path=files/images/<br /><br />
Then create a support_image_template.html file in your template directory and include the following tags.<br /><br />
&lt;SUPPORTING_IMAGE&gt;<br /><br />
Brought to you by <a href='http://www.richardhoutby.com'>http://www.richardhoutby.com</a>";

$addon_version = "1.0";
if (isset($_GET['pic'])) {
$image = $_GET['pic'];
}
else {
$image = "none";
}
if (isset($_GET['path'])) {
$path = $_GET['path'];
$image = "<img src=\"".$path."".$image."\" title=\"Alternate image\" alt=\"".$path."".$image."\" border=\"0\" />";
}
else {
$image = "<img src=\"images/".$image."\" title=\"Alternate image\" alt=\"Alternate Image\" border=\"0\" />";
}
$tpl = ereg_replace("<SUPPORTING_IMAGE>",$image,$tpl);
?>



Then just create a new whatever_template.html file and put a <SUPPORTING_IMAGE> tag in the body. Where that tag is, it'll replace it with an image (assuming the file actually exists).

Then you can use the address to control the filename to show... and even the path.

Hope that helps.

djaef
10-14-2006, 06:09 AM
OK, thanks Richard. It took me a while, but I got it to work. You can see it working on today's entry (If books could talk). There's a link in the comments pop up to the new supporting shot.

And I realised that you can't have image titles and all that because the image has just been ftp'ed straight into the image folder without title etc... So my implementation is not so integrated into the blog but rather a new separate window, but I suppose that that's how I wanted it anyway... :)

Edited to ask: how do I attach the id="photo" to the <SUPPORTING_IMAGE> so I get the white border back?

RAitch
10-15-2006, 03:30 PM
I can't find the example you're talking about... so I'll have to guess what you mean.

In your normal image_template.html, there are div wrappings that control the border of your image. In your case, it's the #photo div.

So you can use the same div within your new supporting image page and it should format the image the same way:
<div id="photo"><SUPPORTING_IMAGE></div>

I hope that's what you were talking about.

Vernon.Trent
10-15-2006, 08:21 PM
coool :)

djaef
10-16-2006, 12:17 AM
I can't find the example you're talking about... so I'll have to guess what you mean.


Richard, there's a link in the image info in the comments on http://www.photografica.com.au/blog/index.php?showimage=30

In your normal image_template.html, there are div wrappings that control the border of your image. In your case, it's the #photo div.

So you can use the same div within your new supporting image page and it should format the image the same way:
<div id="photo"><SUPPORTING_IMAGE></div>

I hope that's what you were talking about.

That's what I thought, but when I coded it like that, the white border went all the way to the sides. The top and bottom was fine, but on the sides, it stretched to the edge of the browser window. In the end I gave up. No doubt some silly error in my coding.

RAitch
10-16-2006, 02:40 AM
Richard, there's a link in the image info in the comments on http://www.photografica.com.au/blog/index.php?showimage=30
Man, that was hidden really well... no wonder I missed it (serves me right for not reading the whole thing)


That's what I thought, but when I coded it like that, the white border went all the way to the sides. The top and bottom was fine, but on the sides, it stretched to the edge of the browser window. In the end I gave up. No doubt some silly error in my coding.
Maybe you should set-up a new DIV for it then... one that specifically specifies the border, margins, and padding. Maybe it has something to do with your margins?? I dunno, I'm not an HTML/CSS expert (nor PHP for that matter).

Looking at the pages, they seem to be formatted the same as far as the DIV/formatting stucture is concerned anyway. I'd think it should show up the same... as the HTML, BODY, A, and PHOTO DIVs are the only impact on both pages... as long as they're the same CSS file, I'd think you'd be good to go.

Must be something minor.

djaef
10-16-2006, 03:27 AM
yeah, especially since I just took the images_template and edited that. I thought a div was a div.. If it gets the css styling form the id="photo", then what can affect that? It must be the div it's in. The div in image_template doesn't go across the whole page does it...hmmm..

Man, that was hidden really well... no wonder I missed it (serves me right for not reading the whole thing)

Ha ha.. ;) Extra pictures will only be a reward for those who bother to read what I say LOL...