timber icon indicating copy to clipboard operation
timber copied to clipboard

Images stored on S3 return NULL for width/height

Open jarednova opened this issue 9 years ago • 7 comments

Spun from #429

Expected behavior

{{ image.width }} should always return an integer based on the width of the image (same goes for height)

Actual behavior

Images stored on S3 return null

jarednova avatar Feb 10 '17 19:02 jarednova

I've tested this locally and it seems resolved... here's the method.

Environment

VVV with PHP 5.6 and WordPress 4.7. S3 Offload Lite and AWS plugins running.

Steps

  • Create a new post, upload an image and set it as the featured image.
  • Observe that featured image is hosted on an S3 bucket (something like http://s3.amazonaws.com/timbertester/wp-content/uploads/2016/06/20110725/hallway-toned.jpg)
  • In the front-end template call {{ post.thumbnail.width }} and have it accurately report the width of the uploaded image.

@tvanantwerp do you think we're good here?

jarednova avatar Feb 20 '17 16:02 jarednova

Sorry for late response--was AFK for a bit. Is this in 1.2.4? I've upgraded locally and tested this with a new post and image upload and still get NULL.

tvanantwerp avatar Feb 23 '17 15:02 tvanantwerp

Ugh!!! can you let me know what steps you followed? I did a local test (see above) but got the values I was expecting

jarednova avatar Feb 23 '17 15:02 jarednova

Running WordPress 4.7.2 on MAMP with Apache and PHP 7.0.12. I first tried WordPress's plugin updates. When that failed, I tried manually deleting and replacing all of Timber with the latest download from wordpress.org.

This:

{{dump(post.thumbnail.width)}}
{{dump(post.thumbnail.height)}}

Returns this:

NULL
NULL

tvanantwerp avatar Feb 23 '17 15:02 tvanantwerp

Same here on 1.7.1. Workaround is to use this in PHP:

unserialize($post->thumbnail()->_wp_attachment_metadata)['width']

75th avatar Jul 03 '18 19:07 75th

Is this issue resolved? I'm still experiencing this while using WP Offload Media plugin.

piotrkulpinski avatar Sep 03 '21 12:09 piotrkulpinski

Based on the reports it seems like this is still an issue. Reopening.

gchtr avatar Sep 03 '21 12:09 gchtr

As discussed yesterday, we are going to close this since this is such an old issue. If anyone still runs into issues, please let us know.

Levdbas avatar Dec 14 '23 08:12 Levdbas

@Levdbas this is till definitely an issue for users of https://github.com/humanmade/S3-Uploads

conwaydev avatar Apr 23 '24 18:04 conwaydev

Hi @conwaydev , are you able to help us debug this issue?

Levdbas avatar Apr 24 '24 14:04 Levdbas