0

I have an issue where running the following function is returning the error report:

 "Cannot create image resource. File not found.";i:1;s:2101:"#0 /var/www/html/jack-london/lib/Zend/Pdf/Image.php(124): Zend_Pdf_Resource_ImageFactory::factory('http://127.0.0....')

Here is my code:

$imgPath = Mage::getStoreConfig('sales_pdf/firegento_pdf/factoryx_logo_image');
$logo = Mage::getBaseUrl('media') . "logo/" . $imgPath;

Which is returning me the correct image path:

http://127.0.0.1/media/logo/default/cat.jpg

If I paste it into my browser, the image loads as expected.

Here is my attempt to convert the path into a Zend Image Object:

$logo = Zend_Pdf_Image::imageWithPath($logo);

This is the place in my code where my error report gets generated. I have tried adding quotations around the $logo variable like so:

$logo = "\"" . $logo . "\"";

But it didn't help at all. Not sure what I'm doing wrong here.

1

I found an answer to this pretty quickly..

This path: http://127.0.0.1/media/logo/default/cat.jpg

Was not what was needed for the function, it needed this instead:

media/logo/default/cat.jpg

Hope this can help someone

  • Jack how you do it ? my path is /pub/media/custom_options/quote/m/y/ouekzgkdFO60ZeHs2djEIGNalvMaPfK9 and i concatenate '.png' extension then it give error file not found even file eixst – HaFiz Umer Jul 31 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.