|
-
May 30th, 2010, 02:08 PM
#1
Thread Starter
Junior Member
Help including files outside of web/public_html folders
Hey, on my readynas duo i have a share called movies, inside the movies share there are hundreds of subdirectories each with a movie file (mostly avi), a txt file (Details.txt) and an image (cover.jpg)
i am trying to list the contents using a php script, so far i can get the info from the text file but not the image as its not in my web share...
Here is what i have:
<?
$MovieDir = "/c/Movies/The.Taking.of.Pelham.1.2.3[2009]/";
$DetailsFile = $MovieDir . "Details.txt";
$CoverFile = $MovieDir . "cover.jpg";
$fh = fopen($DetailsFile, 'r');
$theData = fread($fh, filesize($DetailsFile));
fclose($fh);
$delimiter ="@";
list($title, $year, $genre, $plot, $tag, $imdb, $created) = explode($delimiter, $theData);
echo "<table border='1'><tr><td>";
echo "<b>Title:</b> $title<br>";
echo "<b>Year:</b> $year<br>";
echo "<b>Genre:</b> $genre<br>";
echo "<b>Plot:</b> $plot<br>";
echo "<b>Tagline:</b> $tag<br>";
echo "<b>IMDb:</b> $imdb<br>";
echo "<b>Created:</b> $created<br>";
echo "</td><tr>";
echo "<img src='" . $CoverFile . "></tr</td></table>";
//echo $theData;
?>
Obviously the last image tag is incorrect but you can see what i am trying to acomplish by what i have typed there, is there a function in php that will alow me to include it/load it into a variable etc... for use as the web path is "/c/web..." and the movies are in "/c/movies..." etc...
Thanks, Paul.
Last edited by rrafluap; May 30th, 2010 at 02:45 PM.
-
May 30th, 2010, 03:27 PM
#2
Re: Help including files outside of web/public_html folders
so long as the path is the absolute URI to the image, it should work fine -- especially if you're already able to open the text file. look at the path that it's creating and try opening it in your browser -- it would be looking for a path similar to: http://localhost/c/Movies/The.Taking.of.Pelham.1.2.3[2009]/cover.jpg.
you're missing an end quote for the src attribute of your <img> tag, also.
-
May 30th, 2010, 04:07 PM
#3
Thread Starter
Junior Member
Re: Help including files outside of web/public_html folders
 Originally Posted by kows
so long as the path is the absolute URI to the image, it should work fine -- especially if you're already able to open the text file. look at the path that it's creating and try opening it in your browser -- it would be looking for a path similar to: http://localhost/c/Movies/The.Taking.of.Pelham.1.2.3[2009]/cover.jpg.
you're missing an end quote for the src attribute of your <img> tag, also.
that wont work though because that would mean the path to the cover file would be /c/web/c/movies/The.Taking.of.Pelham.1.2.3[2009]/cover.jpg because /c/web is the location of the php script and the movies folder is a completely different folder
i hope that makes sense
-
May 30th, 2010, 05:00 PM
#4
Thread Starter
Junior Member
Re: Help including files outside of web/public_html folders
Found what i needed...
create a file called picture.php:
<?php
$MovieDir = "/c/Movies/The.Taking.of.Pelham.1.2.3[2009]/";
$CoverFile = $MovieDir . "cover.jpg";
header('Content-type: image/jpg');
readfile($CoverFile);
?>
then use the image source as picture.php
Thanks, Paul.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|