PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Allow user to pick from a prepopulated image pool for a category

  1. Hi

    I have a form set using User Reg add-on. This has standard form field for registration plus some post ones. The user can upload a image to use as a featured image. Now what i was wondering is if there was away I could create a image pool and let the user select from there instead of uploading their own?

    Thanks

    Posted 7 years ago on Friday March 1, 2013 | Permalink
  2. Yes. You would have to display all the images, and allow the visitor to click on one. You can replace radio buttons with images and have them click the image, and then you can use the path to that image in your post, as the featured image. The radio button label supports HTML so you can insert the <img> tag there. You will have to do some work with the layout, maybe in a grid.

    I replaced radio buttons with images here:
    http://gravity.chrishajer.com/country-of-origin/

    Or, you could do something similar with conditional logic. Have your drop down of descriptive names for the images, and when they make the drop down selection, you use conditional logic to display the image over to the side.

    I use a radio button choice here to trigger conditional logic to display an image. The images in this example are all in individual HTML blocks.

    http://gravity.chrishajer.com/different-image-for-each-radio-button-selection/

    The process would be similar with a drop down.

    Posted 7 years ago on Tuesday March 5, 2013 | Permalink
  3. Thank you very much..I will give these a try and let you know the results..thanks again.

    Posted 7 years ago on Tuesday March 5, 2013 | Permalink
  4. Hi Chris

    Sorry to sound dumb but I have tried to do it myself but I am a newbie to GF!...any chance you could talk me through how you exactly achieved version 2 ( Conditional Logic ).

    Thanks

    Posted 7 years ago on Wednesday March 6, 2013 | Permalink
  5. Hi

    Figured it out...."individual HTML blocks"...thanks chris..and your welcome, but I realize I need to use technique one..not sure how to output the result as a featured image though??

    Thanks

    Posted 7 years ago on Wednesday March 6, 2013 | Permalink
  6. I just explained something similar here. Maybe this code will help:
    http://www.gravityhelp.com/forums/topic/display-featured-image-selection-based-on-conditional-logic#post-162117

    Posted 7 years ago on Wednesday March 6, 2013 | Permalink
  7. Hi Chris

    Thanks for that but I am stuck on the last part. This is what I have so far
    http://pastebin.com/XSmn5BvM

    My code does everything right apart from attach the image that was selected by the user in the form.....help not sure how i pull the image and display it

    Thanks

    Posted 7 years ago on Wednesday March 6, 2013 | Permalink
  8. Can you share a link to the page on your site where we can see this functionality?

    I would use the img tag in the radio button label, and then for the value store the attachment ID, since that is what you need for the WordPress function set_post_thumbnail. What does field 14 in your entry hold ($entry['14'])?

    Posted 7 years ago on Tuesday March 12, 2013 | Permalink