Skip Navigation

[Resolved] [HOW?] Custom Image field – Provide a choice of upload or direct link to image

This support ticket is created 6 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.

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 2 months ago.

Author
Posts
#1120932

I am trying to how to provide an option to either upload an image in a post OR provide a direct link to image.

I am creating a directory of websites. Some websites in their Terms of Service do not permit downloading of any of their images then uploading onto a different server. Instead, they may allow linking to that image. Therefore, in filling out the fields in the post for my directory, want to provide both options but only 1 or the other, not both.

1) How?
2) Do you know of a similar directory already created so that I am not reinventing the wheel?

Thanks.

#1121351

One very simple way is to paste the URL of a valid image into the Types Image Field (with which you can also upload)
It will display it if existing, it's just an image tag calling an image stored somewhere.

If you need more control, I would create 3 Fields, an Image Field and a simple URL or even just a single line field, and a Radio or Checkbox Field, which allows you later to decide "URL or Image?"

Then apply a Condition where you create the Fields in Types, which listens to the Checkbox or Radio field and displays each (Image or Single Line) field depending on it's set value.

So later, when editing a post or with a Toolset form, you can choose "Image or URL?", and that will show either Image Upload Field or single line URL to be populated.

Later you can check with HTML conditions what is provided and display either field on the posts.

However, usually (if the image URL is valid) just pasting it into the field and saving works just like uploading an image.