Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

imagecolorallocatealpha() expects parameter 2 to be long, string given #82

Open
mecha opened this issue Sep 21, 2013 · 4 comments
Open

Comments

@mecha
Copy link

mecha commented Sep 21, 2013

We keep getting a bunch of these warnings every now and then. They come and go randomly.

The source of the warning is wpthumb.background-fill.php, lines #62 - #86.

Using line #64 as an example, I think the parameters that are in the form substr( $colors['left'], 0, 3 ) need to be casted to a long value.

According to the PHP Manual comments, a simple solution to do this without getting bit overflow is by simply adding zero.

substr( $colors['left'], 0, 3 ) + 0

Regards :)

@joehoyle
Copy link
Member

Thanks @mekku93 I think maybe is failing to get the colors, which would explain the intermittent nature. Can you upload the image that produces this warning of alternatively email joe hoyle at gmail dot com

@mecha
Copy link
Author

mecha commented Sep 28, 2013

There is no particular image.
We are using it with a plugin that fetches images from various sources.

This warning appears for various images but as I said, it shows randomly and it may work for a particular image at one moment, and fail on refresh.

( I think it is worth noting that the image is still displayed properly, even though this warning is shown. )

@jgalea
Copy link

jgalea commented Oct 20, 2013

Same thing, when rendering images via WPThumb, I sometimes get these warnings:

Warning: imagecolorallocatealpha() expects parameter 2 to be long, string given in ....WPThumb/wpthumb.background-fill.php on line 76

Try this code, it happens on my local installation. You probably need to set WP_DEBUG to true to see these warnings:

echo '<img src="' . wpthumb( 'http:https://s8.postimg.org/l0pouom41/image.jpg', 'width=500&height=500&crop=1&background_fill=solid' ) .'"" />

@jgalea
Copy link

jgalea commented Oct 20, 2013

See #89

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants