how to get path to images in the uploads folder to be used in a plugin

I have some folder with images in /wp-content/uploads. I also have a plugin file in /wp-content/plugins. I want to retrieve the images stored in /wp-content/uploads and use them in the plugin file.

I have tried

echo'<img src="https://wordpress.stackexchange.com/questions/75887/USER_PHOTOS/ronny"" href="#"></img>';

can someone show me how I can get the path to these images?
thanks.

5 s
5

If I’m not mistaken, you may want to try the wp_uploads_dir function, like so:

$uploads = wp_upload_dir(); 

echo '<img src="' . esc_url( $uploads['baseurl'] . '/USER_PHOTOS/ronny/' ) . '" href="#">';

Leave a Comment