Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   Internet Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=25)
-   -   Javascript Gallery Creator (https://www.cableforum.uk/board/showthread.php?t=19725)

punky 04-11-2004 23:12

Javascript Gallery Creator
 
I stumbled across this, it is great and should be of use to someone else. It takes a directory listing of pictures, and automatically makes a gallery out of them. I have tried it in IE and FireFox and it works.

Instructions:

1. Save the following code as a bookmark. (If you are using IE, add any page as a bookmark, then right click on the bookmark in Favourites, and then goto properties, and manually change the link. Click accept if it gives you a warning).

Code:

javascript:var sHTML='<html><head><title>gallery</title><body><center><table border=0>';var y=0;links=document.getElementsByTagName(%22a%22); for(x=0;x<links.length;x++){a=links[x].href; if (a.match(/jpeg|jpg/i)){sHTML+='<td style=%22border-style:solid;border-width:1px%22><a target=%22_new%22 href=%22'+a+'%22><img border=%220%22 width=%22100%22 src=%22'+a+'%22></a></td>'; if (!((x+1)%5)) sHTML+='</tr><tr>'}};document.body.innerHTML=sHTML+'</table></center></body></html>';document.close();
2. Go to a directory with some pics in it.

3. Click the bookmark and it will automatically thumbnail the pictures for browsing.

EDIT: Now fixed, the board kept screwing the JS link up.

homealone 04-11-2004 23:39

Re: Javascript Gallery Creator
 
hey - it works :)

:nworthy: oh bouncy one - way to pogo :)

Bifta 04-11-2004 23:41

Re: Javascript Gallery Creator
 
If only you could resample images with javascript too :(

punky 04-11-2004 23:45

Re: Javascript Gallery Creator
 
Yeah it is a shame PHP isn't interactive where you could.

I probably could do it, by hosting a PHP doc, which takes a url as a value, and does it. This is fairly quick and easy though.

Bifta 05-11-2004 00:38

Re: Javascript Gallery Creator
 
Ah I've got PHP scripts that do exactly the same, someone posted one on their blog (elsewhere), admittedly it was a little bit more than one line of code, but you still only had to upload a single document into the folder with the images in. Very handy.

Richard M 05-11-2004 00:49

Re: Javascript Gallery Creator
 
Quote:

Originally Posted by Bifta
Ah I've got PHP scripts that do exactly the same, someone posted one on their blog (elsewhere), admittedly it was a little bit more than one line of code, but you still only had to upload a single document into the folder with the images in. Very handy.

I created my own gallery script which I think you nicked code out of before ;) - it's best to experiment really.
I rarely use Javascript these days because PHP is so much more powerful, especially in cases like this.

BTW Punky - you could make that code standards compliant if you wanted to. ;)

Dude111 10-08-2009 23:41

THAT IS QUITE AWESOME!!!!!!

I can find alot of uses for something like this :)

joglynne 10-08-2009 23:44

Re: Javascript Gallery Creator
 
WOW Dude you sure dig deep. :)


All times are GMT +1. The time now is 00:44.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum