Title: eddyfly's Replies | WordPress.org

---

# eddyfly

  [  ](https://wordpress.org/support/users/eddyfly/)

 *   [Profile](https://wordpress.org/support/users/eddyfly/)
 *   [Topics Started](https://wordpress.org/support/users/eddyfly/topics/)
 *   [Replies Created](https://wordpress.org/support/users/eddyfly/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/eddyfly/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/eddyfly/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/eddyfly/engagements/)
 *   [Favorites](https://wordpress.org/support/users/eddyfly/favorites/)

 Search replies:

## Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Plugin: User Photo] How do I return just the image URL?](https://wordpress.org/support/topic/plugin-user-photo-how-do-i-return-just-the-image-url/)
 *  [eddyfly](https://wordpress.org/support/users/eddyfly/)
 * (@eddyfly)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/plugin-user-photo-how-do-i-return-just-the-image-url/#post-1324772)
 * Not wanting to mess about with the plugin, I did this on the font end instead.
 *     ```
       // regular expression:
       $matchSrc = "/src=[\"' ]?([^\"' >]+)[\"' ]?[^>]*>/i" ;
       // get the <img src="... from the plugin, via one on various methods explained in the documentation...
       $avatar = get_avatar($user->ID, 64); // for example
       // preg match to extract the src= bit
       preg_match($matchSrc, $avatar, $matches);
       $theImageUrl = $matches[1];
       ```
   
 * That gives you everything between src=”[…]”.
 * I wanted to use it for the background of a div…
 * `echo "<div style='background:url($theImageUrl) center no-repeat;'>";`
 * I hope it helps 🙂
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [topic of the week](https://wordpress.org/support/topic/topic-of-the-week/)
 *  Thread Starter [eddyfly](https://wordpress.org/support/users/eddyfly/)
 * (@eddyfly)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/topic-of-the-week/#post-1430233)
 * Thank you. This looks like it will be very useful starting point.

Viewing 2 replies - 1 through 2 (of 2 total)