Hi,
I'm trying to make a shortcode that will list all the images in a certain folder on my server. The reason I want to do this is so I can upload images to a folder, then have the shortcode list all the images in that folder and put them into a jquery slider gallery.
What I've got so far is this:
This is a decent start, I get a array listing of the filenames and their paths. But I dont know where to go from here. Does anyone know how I can convert this array view to something more usable, like a <img src=""> tag for each filepath?
I am obviously not very good with PHP so I would appriciate all help. I undertand you have to use return to get the shortcode to work properly in editable regions, but I can't figure out how to list these variables as something I can use to display images.
Does anyone have any suggestion on a better way of doing this?
I'm trying to make a shortcode that will list all the images in a certain folder on my server. The reason I want to do this is so I can upload images to a folder, then have the shortcode list all the images in that folder and put them into a jquery slider gallery.
What I've got so far is this:
- Code: Select all
// 4.
// Galleri
// Usage: [galleri foldername]
$FUNCS->register_shortcode( 'galleri', 'galleri_handler' );
function galleri_handler( $params, $content=null ){
global $FUNCS;
extract( $FUNCS->get_named_vars(array(
'folder' => '',
), $params) );
$dir = "couch/uploads/image/artikkler/$folder/";
$images = glob($dir.'*.jpg');
return print_r($images, true);
}
This is a decent start, I get a array listing of the filenames and their paths. But I dont know where to go from here. Does anyone know how I can convert this array view to something more usable, like a <img src=""> tag for each filepath?
I am obviously not very good with PHP so I would appriciate all help. I undertand you have to use return to get the shortcode to work properly in editable regions, but I can't figure out how to list these variables as something I can use to display images.
Does anyone have any suggestion on a better way of doing this?