I have an array of images as strings pulled from the DB, I am pulling these into the browser by means of an ajax call. I’ve got the controller action setup and am able to view the image arrays with associated data, but when I attempt to render the images by iterating over the array and preceding each string with a header, only the first image display. I am assuming this is because either the browser is unable to determine the length of each image string, or Zend is sending the headers first and then the image data, I am uncertain. I have tried multiple methods of encapsulation, output buffering, etc. with 0 success.
We are attempting to avoid keeping these images on disk, otherwise I’d simply be storing the path and id and reflecting this in the view helper. Is there an obvious approach here that I’m missing? Or possibly a feature of Zend I’m unaware of to facilitate what I’m trying to do?
UPDATE: I added the solution I ended up with below.
I ended up going with a rather simple solution; creating two actions within the same controller. The first constructed the markup for the images, iterating over an array created from the model function that pulled all the images for a particular client/event, this would produce:
The second action would accept the resource request from the image, get the imgKey by _request->getParam(); and then serve the header and string for each image. This allowed me to utilize the user authentication and session schemes already in use. Maybe this approach will be useful to someone else.