I'm just starting out with the possibilities of PHP, I've been reading around about Php for a couple of weeks and want to start a project and start learning more!
I'm a designer and want to create a simple portfolio, I want to load a bunch of .jpg files from the server into my flash front using php > xml >flash. So I will use "echo" in Php to make my Xml for flash, also I will use "getimagesize" to return width and height of my .jpgs.
Finally, my questions are:
How can I have Php list the names of my .jpg files in an Array? Is it possible? Do I need to use mysql(I'd rather not if possible)? Can you help or point me in the right direction to get help?
Cheers,
Blyant
Newbie Question (getting started)
Moderator: General Moderators
one thing you could do is to store all of the addresses of the file into a txt file and then use the file() function to read line by line, which is autmatically thrown into an array
If you dont wish to have a file, you could use some of the Directory Functions to get all the files in a directory, and then parse the strings (which would be the jpgs), and use your image functions to output the info into XML
If you dont wish to have a file, you could use some of the Directory Functions to get all the files in a directory, and then parse the strings (which would be the jpgs), and use your image functions to output the info into XML
Code: Select all
<?php
$array = array();
if ($handle = opendir('/path/to/files/')) {
while (($file = readdir($handle)) !== false) {
if (substr($file, -3) == 'jpg') {
$array[] = $file;
}
}
}
?>