Skip Navigation

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

Problem:
Update media sizes metadata in media translation duplicates
Solution:

https://wpml.org/forums/topic/update-media-sizes-metadata-in-media-translation-duplicates/#post-13652415

0% of people find this useful.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 6 replies, has 3 voices.

Last updated by Bruno Kos 11 months, 2 weeks ago.

Assisted by: Bruno Kos.

Author Posts
April 9, 2023 at 1:35 pm #13434219

oldrichH

Tell us, what are you trying to do?
I've changed the size settings and the total set of generated thumbnails for the existing template.

Is there any documentation that you are following?
https://developer.wordpress.org/reference/functions/remove_image_size/
https://developer.wordpress.org/reference/functions/add_image_size/

Is there a similar example we could see?
hidden link - requested images does not exist anymore (they are loaded from CDN cache)
hidden link - original language is updated

What is the link to your site arc.cz

Simple. The entries for the duplicated media for translation in the postmeta table have not been updated by the wp CLI process wp media regenerate. I have no idea how to update these records for existing image sizes.

The question can only be answered by someone who is familiar with WP database architecture and WPML. The problem does not need to be replicated, it is a general question on how to proceed in the situation.

April 10, 2023 at 4:09 pm #13438457

Andreas

Hi,

before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

I understand what you are asking but I am afraid that at the current point, it will not work with CLI because we are not having support for CLI and the command doesn't know to check thumbnails per language in the database.

We can add feature requests if you wish.

As I workaround to regenerate the thumbnails per language, I would suggest this solution :

https://wpml.org/forums/topic/translated-post-doesnt-duplicate-the-image-sizes-from-the-original-post/#post-10333975

Regards,
Andreas

April 12, 2023 at 9:45 am #13453983

oldrichH

Hi Andreas,
if you mean the Regenerate thumbnail plugin I tested it and discarded because I was not sure how it works since the WP 5.3 update. I found it generates unnecessary thumbnails in the form of name_scaled-withxheight.jpg etc. That's why I became interested in native image regeneration support, which is reliable even for sites with a large number of images like ours. Using the WP CLI seems to me to be the ideal choice. I would definitely recommend including functionality in WPML that somehow accounts for resizing thumbnails. I've tried manually regenerating the translation image, e.g. WP MEDIA REGENERATE 1255, but even then the POSTMETA table entry is not updated and the WP CLI handles the original file by default.
So in its current form, WPML does not even support changing themes, as this is usually associated with changing thumbnail sizes as well.

However, maybe your colleagues can advise me on some magic SQL statement that will ensure that the updated POSTMETA size data of existing thumbnails is transferred to their translation copies without overwriting the translated text in them.

Otherwise there's nothing to debug here, I'm really only referring to the basic functionality of WP and WPML. If your way of translating media can be considered an ideal standard, perhaps WordPress itself could support it instead. But I don't know how other translation plugins work.

If you need, I can export and attach a sample of non updated field from wp_postmeta.

With best regards,
Jiri

April 12, 2023 at 12:06 pm #13455719

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

I submitted this as a feature request that would be "wp media regenerate working for thumbnails in all the languages".

I think this describes it well, let me know if any further details you want to share with us.

Regards,
Bruno Kos

April 15, 2023 at 3:15 pm #13479209

oldrichH

Can't we come up with some SQL statement that would handle this once? BTW, I was doing a database inventory and found inconsistencies with some attachment file posts whose TRID was tied to a page type attachment. I could tell you what's going on under the hood of our WPML...

April 17, 2023 at 7:40 am #13484677

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

I do not think that would work as we need to process all media and recreate physical copies of these files, nor I have any example of such SQL queries.

Regards,
Bruno Kos

May 16, 2023 at 7:01 am #13652415

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

After examining various use cases and all the tickets we had so far, it was decided not to implement such feature request given that it can be done through plugins such as Regenerate thumbnails and is in fact a rare occurrence where such complex functionality in WPML would be needed.

Regards,
Bruno Kos

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