The image can't be found by your browser because it's looking for it at the URL "http://domain.tld/temptest.png" which relates to location "/Applications/MAMP/htdocs/surveyanyplace/site/public/temptest.png" on your disk and is not where the file was saved (it's "/temptest.png" as you noticed).
In order to directly serve files via your web server (Apache) you have to make sure the image file is under it's DocumentRoot
(typically the "public" folder of your Zend Framework application)
One way is to create the following directory : "/Applications/MAMP/htdocs/surveyanyplace/site/public/qrcodecaches" and change $pngAbsoluteFilePath
and $urlRelativeFilePath
as follows:
$pngAbsoluteFilePath = APPLICATION_PATH . '/../public/qrcodecaches/' . $fileName;
$urlRelativeFilePath = '/qrcodecaches/' . $fileName;
($tempDir
can be removed)
NB: You might want to take a look to Zend_View_Helper_BaseUrl to make $urlRelativeFilePath
more portable when dealing with applications inside a subdirectory