Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HowTo display pictures?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How can i display pictures in PHP??
 
Depends on what you mean. Most people (including myself) will recommend against storing the actual binary file in your database. Instead, store the file name, such as "mypic.gif" in a field. Then when you pull it out it will be just like any other variable from a query:

<img src=&quot;/whateverdir/whatever/<?php echo $myPic; ?>&quot; border=0>

Is that what you mean?
 
No. I just want to display pictures from a picture file.

(Naits = Mr. Beginner , i have regitred this name insted)
 
What is a &quot;picture file&quot; -- can you provide more details?
 
So I'll work on the assumption that you mean you have a file (let's call it mypictures.txt) and the first line in it says

picture.gif, me.jpg, examples.gif

I'm also assuming that you want to read this file and get the picture names out, then display them using HTML. Going on a lot of assumptions, but here goes...

$fcontents = file('mypictures.txt');
$pictures = explode(&quot;, &quot;, $fcontents[0]);
$picturesLen = count($pictures);
for ($i=0;$<$picturesLen;$i++)
echo &quot;<img src='&quot; . $pictures[$i] . &quot;' border=0>&quot;;

Hope that's what you wanted!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top