Skip to content

registerStreamWrapper problems when handling images (getimagesize) #1261

@rollsappletree

Description

@rollsappletree

Hi,
I used registerStreamWrapper for my project and all was fine with older release. Since the last one i had this problem:
when trying to get the image size for images on S3, sometimes values are completely wrong:
eg:

print_r(getimagesize('s3://mybucket/mydir/image.jpg'));

I get

Array
(
    [0] => 160
    [1] => 91
    [2] => 2
    [3] => width="160" height="91"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)

those values are wrong.
In fact if I use the php wrapper (thus calling the image with the public link) i obtain the correct values:

print_r(getimagesize('https://s3.amazonaws.com/mybucket/mydir/image.jpg'));

i receive

Array
(
    [0] => 840
    [1] => 476
    [2] => 2
    [3] => width="840" height="476"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)

This do not happens always, only with some images. But before the libs update it never happened.

Some other times, instead, trying to retrieve those size, i receive an error like this:

PHP message: PHP Warning:  getimagesize(): corrupt JPEG data: 82 extraneous bytes before marker in /mycode/script.php on line TOT
PHP message: PHP Warning:  getimagesize(): corrupt JPEG data: 95 extraneous bytes before marker in  /mycode/script.php on line TOT

How could I help in solving this issue?
Thanks
Carmelo

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions