Skip Navigation

[Resolved] Select image from Media Library in CRED image field

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to allow my CRED form users to select an existing image from the Media Library to use in a custom image field.

Solution: It's not currently possible to select from the Media Library to insert in a CRED field. This feature has been requested but our developers do not have a timeline available for delivery.

Relevant Documentation:
https://toolset.com/forums/topic/add-media-button-instead-of-choose-file-button-in-cred-forms/
https://toolset.com/forums/topic/featured-image-from-image-field/

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 7 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#484292

I am trying to: allow users who use a CRED post form to choose a featured image from one which exists in the media library

Without this, I can see the media library getting pretty big and potentially containing lots of duplicate images as each post will contain a "new" image from an outside source

#484377

Hi Nick,

I can see how selecting an image instead of uploading one would save server space. There is not currently a good way for CRED to access your Media Library directly, and this idea has been sent along to our developers on several occasions as a feature request. Unfortunately I do not have a timeline for when it may be implemented.

It is possible to use a WYSIWYG editor in your CRED form, which would include a button to open the Media Library and allow someone to pick an existing image. This approach isn't ideal because there is no guarantee your user will do what you want them to do. They may put text in instead of an image, so validation here isn't very effective.

It is also possible to upload your own images to the library and build your own form input that allows users to select one. Then you could store a reference to that image in your custom post type as a custom field. That would require a bit of custom code in your CRED template, and possibly some understanding of the CRED API.

You may be interested to read this forum post:
https://toolset.com/forums/topic/add-media-button-instead-of-choose-file-button-in-cred-forms/

Some other users have discussed their approaches to this same issue. Hopefully you can tweak one of these options to meet your needs. Please let me know if I can be of further assistance with this.

#485976

Thanks. Maybe you can add my "vote" for this to be moved up the development priority list?!

When you say I can include a WYSIWYG editor and "hope" people choose an image, I'm not sure how to do this and ensure that the image becomes the featured image.

Thanks

#486332

It would require custom PHP code that hooks into the save_post action. You would need to access the post's attachments and use the set_post_thumbnail function to set the post's featured image. Something similar is done in this other post, but they use an image upload field instead of an existing Media Library item:

https://toolset.com/forums/topic/featured-image-from-image-field/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.