Title: [Plugin: Simple Fields] Adding image through simple fields displays a number
Last modified: August 19, 2016

---

# [Plugin: Simple Fields] Adding image through simple fields displays a number

 *  [phantomdentist](https://wordpress.org/support/users/phantomdentist/)
 * (@phantomdentist)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-simple-fields-adding-image-through-simple-fields-displays-a-number/)
 * Awesome plugin.
 * Have an issue when using a file attachment field to add an image. Just 1 image,
   its not a repeatable field. I’m using
 *     ```
       <?php $portfolioThumb = simple_fields_get_post_value(get_the_id(), array(2, 4), true);
       	echo "<span class='meta-value_portfolio-thumb'>$portfolioThumb</span>";?>
       ```
   
 * Instead of showing the image the images database number is displayed.
 * Looking at the database I see the meta_id, post_id and the following simple fields
   key and meta
 * _simple_fields_fieldGroupID_2_fieldID_4_numInSet_0 192
 * Any ideas?
 * Thanks
 * [http://wordpress.org/extend/plugins/simple-fields/](http://wordpress.org/extend/plugins/simple-fields/)

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

 *  Plugin Contributor [Pär Thernström](https://wordpress.org/support/users/eskapism/)
 * (@eskapism)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-simple-fields-adding-image-through-simple-fields-displays-a-number/#post-1610965)
 * It’s actually meant to be like that. Since I don’t know what the developer wants
   to do with a file (show it? print the filename? output the dimensions?) the plugin
   only returns the file ID, and then you can use WordPress own functions to fetch
   more info about the file.
 * Useful functions include:
 * [http://codex.wordpress.org/Function_Reference/get_post](http://codex.wordpress.org/Function_Reference/get_post)
 * [http://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata](http://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata)
 * [http://codex.wordpress.org/Function_Reference/wp_get_attachment_image](http://codex.wordpress.org/Function_Reference/wp_get_attachment_image)
 * [http://codex.wordpress.org/Function_Reference/get_attachment_link](http://codex.wordpress.org/Function_Reference/get_attachment_link)
 *  [Rob Beschizza](https://wordpress.org/support/users/beschizza/)
 * (@beschizza)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-simple-fields-adding-image-through-simple-fields-displays-a-number/#post-1611121)
 * Quick illustration of how to show an image with Simple Fields:
 *     ```
       <?php 
   
       $selected_value = simple_fields_get_post_value(get_the_id(), "Your Image Field Name", true); 
   
       $theImageURL = wp_get_attachment_url($selected_value);
   
       echo '<img src="'.$theImageURL.'">';
   
       ?>
       ```
   
 *  Plugin Contributor [Pär Thernström](https://wordpress.org/support/users/eskapism/)
 * (@eskapism)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-simple-fields-adding-image-through-simple-fields-displays-a-number/#post-1611122)
 * Thank you very much Beschizza for the example!
 *  [thejacob](https://wordpress.org/support/users/thejacob/)
 * (@thejacob)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-fields-adding-image-through-simple-fields-displays-a-number/#post-1611129)
 * Thanks Beschizza, very helpful. I have another question though.
 * How do I add dimension “rules” to your code? You know, like when you pull a featured
   image from your post with this:
 *     ```
       <?php 
   
       	if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(220,180), array("class" => "alignleft post_thumbnail")); } ?>
       ```
   
 * I want to use the Simple Fields plugin for thumbnail images.
 * Thanks.
 *  [thejacob](https://wordpress.org/support/users/thejacob/)
 * (@thejacob)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-fields-adding-image-through-simple-fields-displays-a-number/#post-1611130)
 * Never mind, I just did this:
 *     ```
       <?php
       $selected_value = simple_fields_get_post_value(get_the_id(), "Thumbnail 1", true);
       $theImageURL = wp_get_attachment_url($selected_value);
       echo '<img src="'.$theImageURL.'" width="75" height="75">';
       ?>
       ```
   

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

The topic ‘[Plugin: Simple Fields] Adding image through simple fields displays a
number’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-fields_fafafa.svg)
 * [Simple Fields](https://wordpress.org/plugins/simple-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-fields/reviews/)

 * 5 replies
 * 4 participants
 * Last reply from: [thejacob](https://wordpress.org/support/users/thejacob/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-simple-fields-adding-image-through-simple-fields-displays-a-number/#post-1611130)
 * Status: not resolved