Im looking to convert a Javascript function that has been written to detect the non-transparent area of an image.
The initial question and answer is here.
The iteration is easily converted to PHP, however im having trouble obtaining the same image data as written here: (getImageData and Uint32Array)
var idata = ctx.getImageData(0, 0, w, h), // get image data for canvas
buffer = idata.data, // get buffer (unnes. step)
buffer32 = new Uint32Array(buffer.buffer), // get a 32-bit representation
x, y, // iterators
x1 = w, y1 = h, x2 = 0, y2 = 0;
Is there a method in which I can get the same data with PHP? The Javascript method given has browser compatibility issues in which I have solved by writing a node application. I would prefer to have a PHP method if at all possible.