Closed Thread Icon

Topic awaiting preservation: image viewer (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=11972" title="Pages that link to Topic awaiting preservation: image viewer (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: image viewer <span class="small">(Page 1 of 1)</span>\

 
evilclown01
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2001

posted posted 01-02-2002 03:43

What is a good way to make a page that views images? So far I already wrote perl script that looks in the folders 1 level deep of the current, and makes a webpage of thumbnails for each. Right now when you click on the thumbnail, it links to itself so you see the picture. But it's with the default white background. What's a better way?

I couldn't get my script to be recursive. If this is the directories:

code:
/fooa
/fooaa
picc.gif
pica.gif
picb.jpg
/foob
picd.jpg



/index.html page. It will link to /fooa and /foob

/fooa/index.html will link to /fooaa and will show the thumbnails for pica.gif and picb.jpg

/foob/index.html will show the thumbnail for picd.jpg

Does that make sense? So what I want is

1)how should I view the images
2)how can i make it read the current directory and deeper?

I think all i need to do is get the folder paths deeper than the current directory recursively (thats what I can't do) then call my sub that makes the thumbnail page.

evilclown01

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 01-02-2002 17:20

well, I ain't no perl programmer, but for 1), why don't you just output a link to the actual image file on the image on the thumbnail page. that way the browser will display just the image when someone clicks the thumbnail.
Or write a script that takes a variable filename for the image, presents whatever html you have around it and replaces an image tag with the passed filename.

I hope this helps,

Tyberius Prime

evilclown01
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2001

posted posted 01-03-2002 01:39
quote:
why don't you just output a link to the actual image file on the image on the thumbnail page

That's what i'm doing right now. I didn't do the second suggestion because I don't have a server installed. (That way if i put this on a cd it will still work)

That part is not so important, but I want to learn how to get an array that holds the path of all folders below the current directory. So if the script was run in / the array would have:

/fooa, /fooa/fooaa, /foob

evilclown01

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 01-03-2002 02:06

Question: How are you going to get the Perl to run if there is no server?
Once you get that figured out I'd use Javascript popups to do the actual viewing.

Gotta go home for my perl ref and I can be more helpful



:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

[This message has been edited by bitdamaged (edited 01-03-2002).]

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 01-03-2002 05:07
quote:
That way if i put this on a cd it will still work



You sure about that?

You do know that perl is completly serverside don't ya? Of course you do, your programming in it after all, but all gripe this to ya anyways...

A perl generated web page must me served from an internet or intranet to a client computer in it's final format. Perl does it's magic on the server and simply sends the client plain vanila HTML. Well it's not always HTML but, at least it would be with a script like yours.

No kiss kiss, no bang bang.

evilclown01
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2001

posted posted 01-03-2002 23:19

I know perl is serverside, i just explained my question wierd. I'll try again

I have a script I run that generates html files, this way I can put the gallery on a cd and it will still work on another computer.

I still don't know:

1)how to write a recursive function. I want an array that has the paths of all directories deeper than the current directory.

2)a good image view thing. I could make a page for each image(instead of just linking to the image), but that seemed like a waste of space.

I've always thought pop-ups were kinda annoying, but maybe most people don't? How do other people do it?

evilclown01

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 01-07-2002 17:53

Well I don't know Perl well enough to write out actual code for you, but a recursive function should generally look like this:

function subDirs ($directory) {
my @dirs = all directories in $directory;
push @allDirectories, @dirs;
foreach $dir (@dirs) {
subDirs($dir);
}
}

@allDirectories is your global variable that will contain all the directory paths when you are done. The part that you need to figure out on your own is how to set @dirs to a list of the directories within the current directory. If you do that I'm pretty sure this will work.

-jiblet

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 01-07-2002 18:25

Yeah I did a bit of checking and there doesn't really seem to be a built in function for this so you will need to parse the files within a directory and fine which are directories and dig into those.

Just to keep overhead down significantly you might want to consider using one directory for all images.



:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

evilclown01
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2001

posted posted 01-08-2002 01:59

I got it to work using File::Find. Now I just need to make thumbnails. I downloaded ImageMagick for that.

evilclown01

« BackwardsOnwards »

Show Forum Drop Down Menu