Skip Navigation

[Resolved] Using WP offload media, works on feature image but not gallery images

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 5 replies, has 3 voices.

Last updated by Waqar 2 years ago.

Assisted by: Waqar.

Author
Posts
#2535055
2023-01-15_19-22-11.jpg

I have a custom post type(Product) with feature image and a custom field gallery - multiple images.
When user create this Product using front end form:
A single image is added into feature image, and offload to Amazon S3, image url in post has changed to s3, works as expected.
Multiple images are added into the custom field gallery, and attached to post, however url in post gallery are not changed to S3, thus not visible on front end. These images have been succesully offload to S3 and I can see the url changed in WordPress media library. It's just the post gallery url remain unchanged. see my attached screenshot.

Please advise. I've use toolset three years ago, and I'm back hoping to make things work. Thank you

#2535651

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Toolset doesn't support WP Offload Media, I'm afraid. The plugin code requires the file to be present on the local server.

We do have an internal ticket about modifying this to enable support for WP Offload Media and similar solutions, but it's not on the current development board and so I can't give any indication of when such changes might be implemented.

(I'm adding this thread to that internal ticket to help raise its priority.)

#2535655

Hi Nigel, thanks for the replying.
The thing is, wp offload works on everything else, including the feature image, but when it comes to multiple instances of the gallery part, it does not change to the external S3 url, but sticking to the local server. I would need to manually select from media library again to make it work. This neverthless breaks the workflow since I need users to do this on front-end.
There are other issues I found with the multiple images part, you can see my third ticket.

#2536137

Hi,

Thanks for writing back.

As Nigel mentioned, Toolset's image type custom field doesn't support images hosted externally, so that alone won't work. You'll need some custom code and workarounds.

Reading through your two most recent tickets, there are two main challenges:

1. Allowing users to upload multiple images through frontend forms
2. Allowing bulk import of multiple images, which are already hosted on the external server.

You can register an additional single-line type custom field, which can have multiple instances. For example, if your image type custom field is "Product Gallery", your new field can be named something like "Product Gallery Image Links".

On your website, you'll need to include some custom code, that is executed every time a new product is created or an existing one is edited, either through the frontend form or through the backend post-edit screen.

That code should get the local/onsite URLs of the images uploaded in the Toolset's image type field "Product Gallery" and then get their respective URLs for the files hosted on the external location and then store them as each instance/record in the new "Product Gallery Image Links" field.

For showing images on the front end, you can get those external image URLs from the single-line type field, using Toolset Types Fields API shortcodes:
https://toolset.com/documentation/customizing-sites-using-php/functions/

And while bulk importing data, you can directly store those external image URLs in this single-line type field.

I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#2536429

Hi Waqar, thanks for your reply. I try to use a work around by having users upload via WYSIWYG, thus images can be uploaded at once, and properly offloaded to S3. My question is can images uploaded in this way be properly read by Toolset gallery? I would still like to use Toolset gallery to display them. Thanks.

#2537713

Thanks for writing back.

The Toolset blocks like gallery, slider, image, etc, all are designed to work only with the 'image' type custom field as a dynamic source, so they'll not work with this workaround.

You'll have to use some custom HTML code or some third-party plugin to generate the gallery, which can use the image links coming from the custom field.

Note: If you'll use a single instance of a 'WYSIWYG' type field to store the multiple images, it will become a little more complicated, compared to my suggested approach of storing each image's URL in the individual instance of a 'single line' type field.

With the 'WYSIWYG' type field approach, you'll have to write a custom code that will get the full content of the field and then split that content into the individual image's URLs, to return them individually.

I hope this makes sense.