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.

Please make sure to update to WPML to the latest and check our list of Known Issues before reporting

This topic contains 20 replies, has 3 voices.

Last updated by Lauren 3 weeks, 3 days ago.

Assigned support staff: Lauren.

Author Posts
February 18, 2020 at 10:31 pm #5519033

kristinaF-2

I am trying to:
Fetch an image using an attachment ID in a given size.

I expected to see:
The full URL to the attachment in the right size.

Instead, I got:
The full URL to the attachment in the FULL size.

This only happens in my other language (Danish), not on my native language (English).

What I am doing:

I am calling

$product->get_gallery_image_ids();

from WooCommerce. It returns an array of image IDS.

On the english page it looks like this:
array(2) {
[0]=>
int(27805)
[1]=>
int(27804)
}

On the danish page it looks like this:
array(2) {
[0]=>
int(35048)
[1]=>
int(35038)
}

Then I call `wp_get_attachment_image_src(35048, 'lazy')` (lazy is the name of my image size).

It returns the FULL url to the attachment, not the correct size. I expected it to be image-24x24.jpg, but instead I get image.jpg.

If I call `wp_get_attachment_image_src` on the english attachment id (27805), I get the correct size.

February 19, 2020 at 10:45 am #5522691

kristinaF-2

I have also tried to rerun the process under Media Translation to add missing media. It took all night (30k rows) but the problem is still there.

February 19, 2020 at 10:55 am #5522801

kristinaF-2

This seems to have happened before: https://wpml.org/forums/topic/translated-post-attachment-is-delivered-in-original-size/

February 19, 2020 at 10:56 am #5522807

kristinaF-2

I have also tried to regenerate thumbnails using

wp media regenerate

- it did not solve the problem.

February 19, 2020 at 11:09 am #5522977

kristinaF-2

And here: https://wpml.org/forums/topic/custom-media-sizes-are-not-available-in-translated-language/

February 19, 2020 at 11:10 am #5523001

kristinaF-2

The strange thing is, say I get the image:

image.jpg, even though I request it in size 24x24. If I try to access the image URL at: image-24x24.jpg it is found and works.

February 19, 2020 at 1:20 pm #5524145

kristinaF-2

Calling `wp_get_attachment_image_srcset` also returns "false", even though on english it returns the srcset.

February 19, 2020 at 8:41 pm #5527511

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for contacting WPML Support. Before a more detailed look, please, try the following:

1 - Run the https://wordpress.org/plugins/regenerate-thumbnails/ and try to get the attachment image again.

2 - If it doesn't work then try to retrieve the ID of the translated attachment item hooking at: https://wpml.org/wpml-hook/wpml_object_id/

Please, let me know if it helps, have a nice day.

February 19, 2020 at 8:52 pm #5527625

kristinaF-2

Thanks for your answer.

Without sounding rude; did you read what I wrote? I told you I already regenerated all thumbnails - All of them are there. Also if I visit the URL directly. I don't want to call the object function you mentioned because this is inside a loop and I'm retrieving A LOT of rows. So using that solution won't work for me.

What about a solution to the cause of the problem?

February 20, 2020 at 5:28 pm #5535477

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I read your message carefully just missed the part you regenerated your thumbnails using the command line instead of the plugin interface, sorry for that.

I forwarded your ticket to our second level support for a detailed guidance in your case, I will update you here as soon as I have some more details from them, thank you for your continued patience and understanding, have a nice day.

February 24, 2020 at 7:04 pm #5557091

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hi there Marcos is off for a few days so I'm stepping in to help out. I hope that is okay. I'd like to escalate this further, and in order to do so I'll need a snapshot of your site to send to our developers. Please make a snapshot of your site using the Duplicator plugin: https://wordpress.org/plugins/duplicator/.

Once the snapshot is complete, either upload the snapshot ZIP file and the installer.php file to a file sharing service such as Dropbox (and share the link in your reply) or right click the Duplicator links in your wp-admin and paste in your reply.

Please note: It is important to reduce the size of the package so please exclude some paths like /cache or /uploads and also exclude archives and media files.

I will also need the username and password of an account that was created BEFORE creating the duplicator package.

I will enable the next reply to be private so only you and I have access to it!

February 24, 2020 at 7:43 pm #5557145

kristinaF-2

Hi there,
I'd like to send you Access to our staging site instead as well as ftp / database info if you need this. Site is too big to duplicate easily. Is this sufficient?

February 24, 2020 at 8:37 pm #5557341

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Our developers will need access to the site in a controlled environment, so if at all possible, it's best to have the duplicator snapshot. You can remove any media files, caching, backups, etc to reduce the size. Alternately, we can set up a staging site on our cloudways server and we can try to migrate the site there. Do either of those options work for you?

February 25, 2020 at 2:02 pm #5562953

kristinaF-2

Hey! Lets set up a staging site on your end. Let me know the instructions for how to deliver the contents.

February 25, 2020 at 7:26 pm #5565611

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Please see my previous private reply and let me know once the migration is completed. Thanks!