PHP - get blob image size - FPDF - getimagesizefromstring doesn't work

2.8k Views Asked by At

So I am using php/oracle to create a PDF via the FPDF class/plugin. I am using the Mem_Image class/script to add a blob image to my PDF, but I am having trouble determining the size of the image. I am running PHP 5.2 so getimagesizefromstring isn't working.

For the image it will have a fixed height that I am able to set in the FPDF class, but the width since it could be portrait - or - landscape image, I'll need to scale the image proportionally.

2

There are 2 best solutions below

1
On BEST ANSWER
0
On

getimagesize() does work with stream wrappers. Unfortunately, php://memory doesn't give you a way to reference it by filename. Either create your own stream wrapper that work smarter or use the VariableStream example.