I am using Sonata Media Bundle to let users upload PDF files. I want to use Imagick to create a preview image of a pdf document. I have a $media object that holds information about my pdf.
When I do die(dump($media)), I see a media object that includes the following line:
#providerReference: "3c4460aae99b0084d08252065bf3eea1817842d9.pdf"
... and opening that file via:
open -a Preview ./data/storage/faq/0001/01/3c4460aae99b0084d08252065bf3eea1817842d9.pdf
... on my mac yields a fully legible PDF.
The problem is that I also see the following line in the browser:
#binaryContent: null
... which means that I can't dump the binary content into a temporary file for the purpose of having Imagick manipulate it.
How do I get a file path that I can hand off to Imagick?
Here is roughly what worked in order to get me a useful reference to a file, complete with valid binary content.