I have loaded an image from database to a variable named $image.
How can I get the width of the image while it is stored in the variable?
The $image variable contains the data of the image. When I store the image, I just read it from the temp folder and write it to the database.
The accepted answer fulfills this question.
However, I am doing some resizing on the $im variable, so I need to reconvert it to string data, that can be done with the imagepng function.
You could use imagecreatefromstring with imagesx.
Like: