Interfacelab / ilab-media-tools

https://mediacloud.press/
GNU General Public License v3.0
112 stars 36 forks source link

ilab_s3_can_calculate_srcset results in a mixture of hard and soft crops #55

Closed dotherightthing closed 5 years ago

dotherightthing commented 5 years ago

My customised gallery displays a bank of thumbnail size images next to a JS driven enlargement.

Thumbnails are 300 x 300, hard crop. This used to result in all thumbnails being 300 x 300, but lately I have seen some 300 x ??? (soft crop) thumbnails sneaking in.

It appears that the srcset contains both the desired thumbnail size (hard crop), and an unrelated medium size (soft crop).

I can't show you a live example, sorry, as the site can't go live until it is working, and I don't currently have a staging server for PHP 7.

I tried using the Regenerate Thumbnails function which didn't help, but I'm successfully working around this issue by disabling the Media Tools filter:

add_filter( 'ilab_s3_can_calculate_srcset', false, 10, 4 );

Edit: but note that doing this results in thumbnails being output with bad rotations.

I wondered if this issue might be due to the process at my end:

  1. Created 200+ posts with images (days of my trip)
  2. Moved images from unpublished posts to a different directory to prevent overloading hosting
  3. Migrated to Media Cloud and AWS/Imgix, without reinstating relocated images first
  4. Now editing unpublished posts, reuploading relocated images
  5. WordPress / Media Cloud is confused about which properties to use for reuploaded images
mushbrain666 commented 5 years ago

Regenerate Thumbnails function within ilab Media Cloud, or the Regenerate Thumbnails wordpress plugin?

dotherightthing commented 5 years ago

Thanks, I tried that first and thought it worked, but subsequent runs didn't help. If there's a newer release of the plugin, I can't test it until I return from an overseas trip.

On Wed, 6 Feb 2019 at 6:21 PM, mushbrain666 notifications@github.com wrote:

Regenerate Thumbnails function within ilab media cloud, or the Regenerate Thumbnails https://wordpress.org/plugins/regenerate-thumbnails/ wordpress plugin?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Interfacelab/ilab-media-tools/issues/55#issuecomment-461012024, or mute the thread https://github.com/notifications/unsubscribe-auth/AAm_l8sheWdct2Qjgbl5WSlogrWviOtuks5vKs--gaJpZM4ZmR0X .

mushbrain666 commented 5 years ago

Are you securing URLs?

Referring to IMGIX signing key, not https

dotherightthing commented 5 years ago

Yes I am securing urls, not sure how that works since you share the key when you share a URL (unless I misunderstand how it works)

On Wed, 6 Feb 2019 at 6:29 PM, mushbrain666 notifications@github.com wrote:

Are you securing URLs?

Referring to IMGIX signing key, not https

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Interfacelab/ilab-media-tools/issues/55#issuecomment-461014362, or mute the thread https://github.com/notifications/unsubscribe-auth/AAm_lxi6BupNDP5AOLncWLqNBD34bPpSks5vKtGvgaJpZM4ZmR0X .

dotherightthing commented 5 years ago

The Regenerate Thumbnails plugin. Is there a way within the media plugin?

On Wed, 6 Feb 2019 at 6:21 PM, mushbrain666 notifications@github.com wrote:

Regenerate Thumbnails function within ilab media cloud, or the Regenerate Thumbnails https://wordpress.org/plugins/regenerate-thumbnails/ wordpress plugin?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Interfacelab/ilab-media-tools/issues/55#issuecomment-461012024, or mute the thread https://github.com/notifications/unsubscribe-auth/AAm_l8sheWdct2Qjgbl5WSlogrWviOtuks5vKs--gaJpZM4ZmR0X .

mushbrain666 commented 5 years ago

Not that I know of. There is image purge in imgix>tools though I haven't used it. Might be worth looking into if you have an issue with particular image or url.

With secure URLS you don't share the signing key (called token in this case). What is appended to the URL is a hash of the token and the url - a combination of your unique token and unique URL. This 'secures' the url so nobody can alter it. Presumably if urls arent secured anybody can alter the url and process an image on your account.

I've been struggling with signing images while doing manual image processing within templates, every change I make to the URL means another hash. You need to sign every unique url. I believe Media Cloud does this for you, but again I'm unsure.

You can check out docs.imgix.com/setup/securing-images, at the bottom there is a section on securing images within your application and a prompt for client libraries.

Not sure this is exactly what your looking for, but it seems like an important component of the whole workflow and if it doesnt happen automagically within media cloud you need to do it yourself.

"if you need to change the parameters yourself, you'll need to re-sign the new URL."

jawngee commented 5 years ago

Srcset has been fixed in 3.0.

Signing happens automatically with Media Cloud.

Regenerate thumbnails is pointless when using Imgix as Imgix is generating thumbnails as needed on the fly.

Can we move more support related questions to: https://discourse.interfacelab.io/

dotherightthing commented 5 years ago

Thanks, I do have URL signing set up in Imgix. I'm aware that Regenerate Thumbnails wouldn't work since there is no local media, but I had to try.

I assume 3.0 is a future release?