php gd imagerotate fails when -1 is passed for $bgd_color
gd, php
Solution
"What server configuration variable should be changed to make -1 work?"
There is no server configuration variable that makes this work. I ran in to the same issue as you (while using a third party library) and discovered that those who were passing in -1 were pretty much lucky that it did work. Based on my research I believe what happened was one person used this, it worked, and the code just got copied into various projects without a real understanding of it's function. I say this because I see the same exact code, including comments, in various projects.
Later versions of the gd library changed the behavior some, breaking the `imagerotate` function for those who were passing in -1 as the background color.
Anyway, the solution is to use `imagecolorallocatealpha` to add a transparent "color" to the image palette, and pass that color as the background color to `imagerotate`. Your solution of: `$tmp = imagerotate($tmp, $angle, imagecolorallocatealpha($tmp, 0, 0, 0 , 127));` should be just fine.
Problem
I had this problem on a client server ``` $tmp = imagerotate($tmp, $angle, -1); ``` $tmp => `bool(false)` with no error message displayed ``` $tmp = imagerotate($tmp, $angle, imagecolorallocatealpha($tmp, 0, 0, 0 , 127)); ``` this works fine $tmp => `resource(89) of type (gd)` What server configuration variable should be changed to make -1 work ? ``` GD Version: bundled (2.1.0 compatible) libPNG Version: 1.2.44 ```