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 2 voices.

Last updated by florianG-3 11 months, 3 weeks ago.

Assigned support staff: Yvette.

Author Posts
October 13, 2018 at 1:12 am #2813214

florianG-3

First of all: I don't use the media translation addon, because I need the same images in all languages.

Now:
I added a custom media size to my child themes functions.php:

add_image_size( 'mm_product_galerie', 768, 479, array( 'center', 'center' ) );
add_image_size( 'mm_product_important', 560, 350, array( 'center', 'center' ) );
add_image_size( 'mm_product_not_important', 260, 350, array( 'center', 'center' ) );

This image size is used in the frontend for a custom post type, like this:

get_the_post_thumbnail_url( $id, 'mm_product_galerie' );

In the original language this works fine, but not in the translated.
Attached are some screenshots of the debug output.
The first shows the output in the translated language and the second show the original language. As you can see in the red box, the image sizes are missing (it's just the main image's url and not the

-768x479.png

version)

Why are these sizes missing? How can I fix that?

October 15, 2018 at 2:26 pm #2817943

Yvette
Supporter

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

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

Hello

Hmmm -I am not sure why this would be the case. I know that you are not using the WPML Media Translation plugin but can you confirm that you have still executed the WPML Media Translation installation included in the CMS core plugin here:

WPML -> Settings -> Media Translation

In the mean time, I will ask some colleagues here if they might have an idea why this is ocurring.
I wait for your feedback on the installation confirmation.

Thanks

October 15, 2018 at 3:13 pm #2818074

florianG-3

I attached a screenshot. I did run it, but still the same issue

October 16, 2018 at 7:41 am #2819971

Yvette
Supporter

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

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

Hello

Would it be possible to get a Duplicator snapshot of your site so that I can confirm the issue and possibly escalate it to our 2nd tier support group?

They have confirmed that this should work. I am opening the private area for you to send me a Duplicator package (just include a link to a filesharing platform I can download it from) or for you to provide system access for me to extract the snpashot from your site (please already install and activate Duplicator).

Thanks

October 22, 2018 at 12:13 am #2836213

florianG-3

Ok it seems I fixed the issue.
I regenerated the thumbnail in the specific language and now it works.

But another question:
Why is it necessary to duplicate all media? I mean my database contains now twice the amount of entries for images, that are identical in both languages anyway. Do I need to do this in order to get images for all languages?

October 22, 2018 at 7:23 am #2836949

Yvette
Supporter

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

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

Hello

You asked:
"...Why is it necessary to duplicate all media? I mean my database contains now twice the amount of entries for images, that are identical in both languages anyway. Do I need to do this in order to get images for all languages?..."

Yes, you must duplicate the wp-post entries for all attachments in all target languages. As WPML will "rewrite" the permalinks for each wordpress language, this duplication will ensure that the image reference is found. If you do not do this, you will see a placeholder image instead.

Note, this does increase the entries in the wp-posts table for media but it does not require you to have a duplicate physical image file.

I hope this answers your question.

October 29, 2018 at 11:42 am #2857682

florianG-3

My issue is resolved now. Thank you!