mardi 13 octobre 2015

Pull All image from a folder in a wordpress plugin

I am working on a wordpress plugin and in that plugin i need to pull all image with .png extention from a folder which reside my plugin images folder. I am using the following code

foreach ( glob( plugin_dir_path(__FILE__ ) .'images/previews/*.png') as $img ) { echo $img.'<br>';
     echo '<img src="$img" alt="">';
    }

when i echo the $img it shows the entire path but when i use this path as the image source it doesnot show the image.It shows a broken image if i dont use the 'alt'. I have searched for it but cant find any solution on web which is working for me. But a raw php file with the same code is working just fine



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire