So I found this tutorial on how to generate images from a folder which works great. I needed this code as most php tutorial ask you to rename your images to 1, 2, 3 etc. I wanted a image generator which allows the images to be any name.
I now need to resize the images to fit?
Here is the code I have got:
<?php $imgpath = "images/"; $handle = opendir( "$imgpath" ); $imgArray = array(); while($file = readdir($handle)) { if( $file != "." && $file != ".." ) { array_push( $imgArray, $file ); } } closedir( $handle ); mt_srand( (double)microtime( ) * 1000000 ); $randval = mt_rand( 0, sizeof( $imgArray ) - 1 ); print( "I am not sure how to add a width and height section in there, any ideas?