SPL contains a class for parsing XML, http://www.php.net/~helly/php/ext/spl/classSimpleXMLIterator.html
Although poorly documented so far it looks promising.
It\'s not always a good idea to rely on $_FILES[][\'type\'] because this is simply the MIME type the client browser has given. This can potentially be faked by a client and browsers can also report the incorrect MIME type or give a generic MIME type.
You can use the getimagesize() function to get the MIME type of an image:
list($x,$x,$mime_type) = getimagesize($_FILES[\'files\'][\'tmp_name\']);
if ($mime_type == \'image/jpeg\' || $mime_type == \'image/gif\' || $mime_type == \'image/png\') {
....
If you need more than just a list of files, the SPL has a DirectoryIterator object: http://www.php.net/manual/en/function.directoryiterator-construct.php
With it you can do more than just list files, you can also get information about their properties, ownership, permissions, whether or not php can write or read from the file etc.
This is a nice snippet but a a minor change that could improve it a bit. The extension could be treated differently so you can specify no extension and only grab files with no extensions. Would be easy to do like this:
function directoryToArray($directory, $extension = false, $full_path = true) {
if ($extension !== false && strlen($extension)) { $extension = \"\.$extension\"; }
And the if statement that checks for a condition:
if($extension !== false || (ereg(\"$extension\$\", $file)))
Then leaving an empty string would return all files with no extensions, or specifying false (or leaving it empty) will return all files.
This function will brand an image with some text. You can give it a filename or an image resource. You can use built-in gd fonts or, with some modification, TrueType fonts if GD on the server supports it. Usage when giving the function a filename: brand_image('/path/to/file','text',font); The font is the built-in GDfont number. This number can be from 1 to 4. See also the PHP function imageloadfont()..
you should add some switches to the /echo such as: /echo -ti2mbfl. The -t will add a timestamp if timestamping is on, i2 will cause wrapped text to be indented, m will cause the window to be highlighted with the \'message\' colour instead of the event colour and bfl will apply beep, flashing and highlighting options as configured in the mIRC options.
This uses the GD library to create a thumbnail out of an image. $infile = path to source image $outfile = file and path to write the thumbnail to $maxw = Maximum width of the thumbnail $maxh = Maximum height of the thumbnail $stretch = Stretch image if it is smaller than the maxw and maxh The function will preserve the aspect ratio of the image. If you specify 0 for either $maxw or $maxh then the function..