Closed Thread Icon

Topic awaiting preservation: PHP - File Manager/Browser Questions. (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=12426" title="Pages that link to Topic awaiting preservation: PHP - File Manager/Browser Questions. (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP - File Manager/Browser Questions. <span class="small">(Page 1 of 1)</span>\

 
Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 09-17-2002 05:28

Ok, First let me try and explain what I'm trying to do.

Have a look at this directory on my web server:
http://www.whatever.net.au/~cameron/ozone/

Messy ain't it. I want to overlay that directory with a nice PHP script that'll make it all pertty (thumbnails and such for the piccies) and easier to browse. Doing that isn't the problem though. The problem is that even with a nice script to organise that mess somewhat I'll still want to clean some bit up. Move the files around such.

The problem is, if I move osme of the images to a different sub-directory or some such the links to it from various external places
(like the Asylum and other boards) will all break.

Is there any way I could use PHP to grab any requests for a file that doesn't extst and search several pre-defined directories fir that file and send back the request all good like when it finds where I moved it too?

Example: Say I've linked to this image:



Which is located here:
http://www.whatever.net.au/~cameron/ozone/RozeSphere.jpg

Then lets pretend that I move that image to say here:
http://www.whatever.net.au/~cameron/ozone/Photoshop/Misc/RozeSphere.jpg

The above links will then be broken, yet I'd like to be able to step in and work some magic so the links and image will still work.

Would I need to frig with the apache settings to do this? I can leave a dummy RozeSphere.jpg file in it's place but I'd prefere if I only ever had one copy of each image on the server. Maybe I could make the dummy RozeSphere.jpg a php file and tell apache to treat it as such?

Any hope of this being possible?

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 09-17-2002 05:45

I think the best method would be an .htaccess file with redirect
RedirectPermanent /path/to/oldfile.jpg

JKMabry
Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

posted posted 09-17-2002 06:40

man, I want a look at that script when yer done, I like pourin through people's oa files I've been meaning to do something to organize them better as well. Wead's is cool but no thumbs and when you look at one you gotta come back and scroll again...

Jason

edit: wow, I knew you were a pretty sharp guy but I obviously missed many of your posts. enjoyed thumbin through =)


[This message has been edited by JKMabry (edited 09-17-2002).]

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 09-17-2002 13:41

Dracusis: See my comment @ 07-30-2002 11:28 AM here:
www.gurusnetwork.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic;f=20;t=000052;p=1

you can then explode the file names and check to see if they are .gif or .jpg (just to be safe) and then use something like GD to thumbnail them.

Eventually, of course this turns into a bit of a gallery script so see the rest of the post mentioned above.

___________________
Emps

FAQs: Emperor

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 09-17-2002 17:30

Jason: OMG you actually looked at all of that! Hah! Some of that is really really old (and crappy). I planted that lil directory of goodness when I first came here about 2 years ago and I've been watering it ever since.

This is my second attempt at a file management/image gallery script. The first one was lost to a HDD death. It's taken me this long to stop being sour about it and try again. Yet when/if I do finish it you can bet I'll make plenty of noise about it.


Emps: that's a nice thread but I'm not seeing anything in there that would help me. I know I could get PHP to search through directories for a specific file but how do I get from a HTTP request for an image/file to PHP. Say I linked to this file in an asylum post several weeks ago:
http://www.whatever.net.au/~cameron/ozone/Photoshop/Misc/RozeSphere.jpg

But now it actually lives here:
http://www.whatever.net.au/~cameron/ozone/RozeSphere.jpg

Yet I still want that first link to work without having to change the post hence getting PHP to but in, work it's magic and send it back nothing but love requesting browser, instead of a 404 page or broken image.

I think Pugzly's suggestion might be one to work with. Do you think I could use PHP to re-write .htaccess files?

Although will a permanent redirect work if it's for an image file specified in an img tag like <img src="blah blah black sheep.jpg"> ???

Oh and can I specify redirects for entire directories?

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 09-19-2002 12:43

Dracusis: I have completely misunderstood your question sorry

I have clearly started answering questions like politicians i.e. no matter what you ask I'll answer a question I want to answer

Pugzly's answer should work nicely but you could use:

code:
RewriteEngine  on
RewriteRule /~cameron/ozone/(.*) /~cameron/ozone/Photoshop/Misc/$1 [L]



It might need a few tweaks and I'm not sure if it will work with links to images (you might, for example, need [R] at the end to actually redirect to the image).

___________________
Emps

FAQs: Emperor

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 09-21-2002 23:26

Cool...

Umm, can I set a .ht file in the /~cameron/ozone directory to do this?

Cause I don't have acess to the main apache .htaccess file.

JMJimmy
Bipolar (III) Inmate

From: Picton, Ontario, Canada
Insane since: Apr 2001

posted posted 09-27-2002 06:56

There are several options to what you want to do.

.htaccess with RedirectPerminant is one

ReWrite is another however I believe the code above may create a loop - not sure though as I'm just learning ReWrite

The other is to create a symlink between the directories. So /ozone becomes /ozone/photoshop/misc/ (basically like a shortcut on your desktop)

JMJimmy

« BackwardsOnwards »

Show Forum Drop Down Menu