path

Ask about a PHP problem here.
Post Reply
Romulas
Posts: 24
Joined: Mon Sep 12, 2011 3:59 am

path

Post by Romulas »

Hi
I am try to make my php script access files from another partition on my harddrive but it does not
seem to work, i have tried the include_path but when i use that the screen goes white and thats all
that happens. I don't get any errors. My script displays thumbnail images.

This is the path i want to use /Files/Catalogue/thumbs/$name
Files is the where the partition is mounted, Catalogue is the directory where the images and thumbs
are stored.

Here is my script
$images = "thumbs/$name/";



    $files = scandir($images);

    unset($files[0], $files[1]);



    $rows = array_chunk($files, 6);

   
		

		foreach ($rows as $row){

						

			foreach ($row as $image){


                         

                                                    

                         echo '<a href="gallery/', $name, '/', $image, '"><img src="thumbs/', $name, '/',$image,'"/>'</a>';

                                          

			

                       }                    

                     }

                 						

?>
This script as it is, works when the images are in www/htdocs/ etc
Curia
Posts: 36
Joined: Fri Aug 26, 2011 4:35 am

Re: path

Post by Curia »

If you are using xammp, then htdocs is seen as the default directory, so simply saying /Files/Catalogue/thumbs/$name is making php think it has to look for a file called Files in htdocs ect, that is why you are not shown anything, although a directory error should pop up at least.
Romulas
Posts: 24
Joined: Mon Sep 12, 2011 3:59 am

Re: path

Post by Romulas »

Thanks Curia
I am using lamp, Files is a directory in the root directory where the partition is mounted.

Thanks for replying
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: path

Post by jacek »

The script will be default look from the folder it is in. so if your script is in /Files/Catalogue/ and you use thumbs/$name/ that is /Files/Catalogue/thumbs/$name/ It would not make sense to have the script you posted look outside of the web root since the images would not be able to be served anyway.

Perhaps you could explain the problem a bit more ?
Image
Romulas
Posts: 24
Joined: Mon Sep 12, 2011 3:59 am

Re: path

Post by Romulas »

Jacek
My script is dealing with a lot of images and my hdd is just about full, so i have added
another hdd to store al the images. I was hoping I could access the images from that location.

Thank you
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: path

Post by jacek »

Yeah it can work, but you need to configure Apache to serve pages from the new HDD instead of the current one.

Which ever server package you use should be able to do that as part of its settings page or it should tell you how somewhere at least.
Image
Post Reply