View Full Version : ?showimage= behavior to use .jpg ID's
tomyeah
11-26-2006, 10:32 AM
hi,
id like to add seom functionality to the showimage command.
like i want to be able to call the site at
http://pixelcandy.tomyeah.com/index.php?showimage=237
with the command
http://pixelcandy.tomyeah.com/index.php?showimage=20061125205030_crw_9837.jpg
you could make a simple php function that looks for the last 4 chars in the string ".jpg" and switch the showimage lookup mode ...
you think that would be possible ? what problems could appear if i link like that to image_template ?
id like to have this function for external plugins that could link back to image_template instead of just linking to the direct image link ....
regards, tom.
I dont get what for do you need it. You can write an addon which can handle it without making some strange changes in core files. Changes in core files will need from you manual changes each time when new version of Pixelpost will be released. Think about making it in addon.
tomyeah
11-26-2006, 11:26 AM
the idea was to be able to jump back from lightbox in browse_template to the according image_template ... for that i need the showimage ID in lightbox , which i cant get, the only thing i can access is the direct picture link. now, when i could feed the picture link into the showimage i could jump back to the image_template.
basically it would just be a mod_rewrite that converts filename to showimage ID.
regards, tom.
You can post more variables in URL and use it for getting back to image_template. I.e. you can call image like http://test.url.com/images/my_image.jpg with some variable like img_temp_id to get link like this:
http://test.url.com/images/my_image.jpg?img_temp_id=152
Then you only need to handle this img_temp_id to get back to image_template with showimage variable set to 152.
More or less its whole my idea for it.
tomyeah
11-27-2006, 06:59 PM
id need an addons that redirects
pixelpost.com/index.php?showfile=019233filename.jpg
to
pixelpost.com/index.php?showimage=152
the question is now if you could use internal information to do that matching or if u need to make a mysql query and search for the filename.
regards, tom.
austriaka
11-27-2006, 08:37 PM
you did not understand what GeoS meant, did you? It is easier to transfer the image id to the lightbox than to change the showimage lookup mode.
In index.php?x=browse you have the id of the image.
In line 717 of (original) index.php you find:
while(list($count,$id,$title,$name,$datetime) = mysql_fetch_row($query))
$id is the image-ID you are looking for.
Try this (I got the following lines from the description at the entrance page of your site):
Open pixelpost’s “index.php” and go to the line with the “$thumb_output” (line 723 for me) and replace it with:
$thumb_output .= "<a href='images/$name' rel='lightbox[views]' title='$title'><img src='$thumbnail' alt='$title' title='$title' class='thumbnails' /></a>";
replace that with
$thumb_output .= "<a href='images/$name?img_temp_id=$id' rel='lightbox[views]' title='$title'><img src='$thumbnail' alt='$title' title='$title' class='thumbnails' /></a>";
This will make a link in Browse template like this:
<a href='images/20061125205405_fresh.jpg?img_tmp_id=241' rel='lightbox[views]' title='fresh'><img src='thumbnails/thumb_20061125205405_fresh.jpg' alt='fresh' title='fresh' class='thumbnails' /></a>
Now you have the image id which is img_tmp_id in your lightbox. All you have to do is to extract it out of the URL and give it to the link with showimage. I suppose you will do that in JavaScript:
var getstring=window.location.search;
var id_array = getstring.split("=");
var img_id=id_array[1];
And maybe "updateDetails: function()" in lightbox.js is the right place for that:
instead of
Element.setInnerHTML( 'caption', imageArray[activeImage][1] + " <a target=_blank href=" + imageArray[activeImage][0] + ">[ link ]</a> ");
write this:
Element.setInnerHTML( 'caption', imageArray[activeImage][1] + " <a href="index.php?showimage= + img_id + ">[ link ]</a> ");
of course not tested ;-)
KArin
More or less thats idea which I wanted to show :P
Other is to write an admin addon which after new image upload updates .htaccess file in root directory of PP with redirection from file names to the PP IDs.
Something like:
RewriteRule ^/show/blablabla.jpg$ index.php?showimage=20
RewriteRule ^/show/blablablarv23.jpg$ index.php?showimage=264
...
tomyeah
03-25-2007, 06:13 AM
i did it my way now :D
i created some showfile.php in my main dir. its the 404 page for my pixelpost.
it checks the db for the filename('image') that i get from lightbox and returns the ID('id') of the image. than it calls index.php?showimage=ID
might not be the most resource efficient routine, but it works like i wanted it and i can use it with other addons and tools too.
example here (http://pixelcandy.tomyeah.com/index.php?x=browse) open the lightbox by clicking a thumb, than click on the caption of the image to get back to image_template via filename.
regards, tom.
Yeah, thats is also interesting solution :)
dakwegmo
03-26-2007, 08:30 PM
tomyeah you may want to consider using a paged archive. I clicked one of the thumbnails before the page finished loading and was taken to the jpg in your images folder. I went back and waited for the page to load, and got the lightbox. With so many thumbnails that need to pop in people are likely to click stuff before the the page is done loading. Like I did ;-)
tomyeah
03-27-2007, 11:39 AM
@dakwegmo get a faster internet connection, luckily my images are only 600px :D
btw, i had to modify the lightbox.js in order to have relative links in IE (FF and all others were fine)
// replace with your own URL
Element.setInnerHTML( 'caption', "<a target=_self href=showfile.php?showfile=" + imageArray[activeImage][0].replace("http://pixelcandy.tomyeah.com/","") + ">" + imageArray[activeImage][1] + "</a>");
regards, tom.
dakwegmo
03-27-2007, 01:09 PM
@dakwegmo get a faster internet connection, luckily my images are only 600px :D
Don't be a jerk, I was just making a suggestion. I've got 8 Mbps connection, so I'm pretty sure the problem isn't on my end. It could be the 160 thumbnails that you got on a single page, which is why I suggested you look at the paged archive option. The thumbnails are loading before all of the fancy stuff you're doing with lightbox which means your website breaks if people don't sit around waiting for all of the files finish loading before clicking on something. Fewer thumbnails on each page means faster load times for everyone. :)
Again, I was just trying to be helpful, but if you're content to display a broken site to people with slower internet connections, who am I to argue?
XerXes
03-27-2007, 03:05 PM
I definately agree with dakwegmo. I discovered the exact same problem while viewing your archive. Apart from that, both your template and lightbox is pretty cool. Although I can't really figure out why you wan't to show you pictures in the lightbox-script instead of in your really nice tempalte.
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.