Page 1 of 1

path

Posted: Wed Jan 11, 2012 1:02 am
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

Re: path

Posted: Wed Jan 11, 2012 10:03 pm
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.

Re: path

Posted: Wed Jan 11, 2012 11:44 pm
by Romulas
Thanks Curia
I am using lamp, Files is a directory in the root directory where the partition is mounted.

Thanks for replying

Re: path

Posted: Fri Jan 13, 2012 2:06 pm
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 ?

Re: path

Posted: Sat Jan 14, 2012 12:59 am
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

Re: path

Posted: Sat Jan 14, 2012 2:02 pm
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.