Title: Programmatically Adding an Image
Last modified: August 24, 2016

---

# Programmatically Adding an Image

 *  [RexAK](https://wordpress.org/support/users/rexak/)
 * (@rexak)
 * [11 years ago](https://wordpress.org/support/topic/programmatically-adding-an-image/)
 * Hi, thanks for the very useful plugin.
 * I am migrating a site, and I need to add images from the old site to the new,
   into a CIMY user field.
 * I am using: `$result = set_cimyFieldValue($user->ID, 'U_BUSINESS_LOGO', $logo['
   filepath']);`
    Obviously, ‘U_BUSINESS_LOGO’ is my field, and $logo[‘filepath’]
   is the full url to the image.
 * I see in the DB that I am able to get the full url path ([http://mydomain.com/wp-content/Cimy_User_Extra_Fields/myfile.jpg](http://mydomain.com/wp-content/Cimy_User_Extra_Fields/myfile.jpg))
   into the ‘cimy_uef_data’ table.
 * However, when I visit the users profile page, there is no preview.
 * And way to make this show up?
 * [https://wordpress.org/plugins/cimy-user-extra-fields/](https://wordpress.org/plugins/cimy-user-extra-fields/)

Viewing 1 replies (of 1 total)

 *  [Julian M](https://wordpress.org/support/users/caesarby/)
 * (@caesarby)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/programmatically-adding-an-image/#post-6152768)
 * Hi rexak,
 * I am not sure, but i guess, you can use this example from [the documentation](https://codex.wordpress.org/Function_Reference/wp_insert_attachment#Example)
   to upload image into media gallery,
 * and then you should update userprofile: `update_usermeta`,
    [something like this](https://developer.wordpress.org/plugins/users/working-with-user-metadata/).
 * I hope, that helps

Viewing 1 replies (of 1 total)

The topic ‘Programmatically Adding an Image’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cimy-user-extra-fields_dae8f3.svg)
 * [Cimy User Extra Fields](https://wordpress.org/plugins/cimy-user-extra-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cimy-user-extra-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cimy-user-extra-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/cimy-user-extra-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cimy-user-extra-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cimy-user-extra-fields/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Julian M](https://wordpress.org/support/users/caesarby/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/programmatically-adding-an-image/#post-6152768)
 * Status: not resolved