Jump to content

FPDF error: Not a JPEG file: /mysite/img/logo.jpg


Recommended Posts

Search the web & forum for a solution to the following error ...

 

FPDF error: Not a JPEG file: /mysite/img/logo.jpg

 

I changed the .jpg file that was there to .jpeg and that did not work, same error. I even tried to rename my logo.png to logo.jpeg and that generate the "alpha channel" version of the error. Based on forum threads I expected that would happen.

 

Any suggestion as what to try next. I did verify the jpeg files are really jpeg generated by PhotoShop.

 

Prestashop version 1.4.7.0

Link to comment
Share on other sites

I’m not sure if this will help. The problem I had is I set my logo to a png, and left that as the default for all in Preferences > Appearance

 

The problem with that is there is a bug in the PDF generator that will only take a jpg file from Invoice Logo. I could have png in all the others but Invoice logo had to be jpg.

Link to comment
Share on other sites

I fixed the problem but I don't know why it is a problem. I simply reloaded the logo.jpg file into Gimp and saved it out again. The image now loads as part of the invoice. There must have been something in the jpg header that was confusing PDF generator.

Link to comment
Share on other sites

  • 3 weeks later...

I have not tested this, but according to this post, you can make the size change in directory - classes - file pdf.php

http://www.prestashop.com/forums/topic/128228-change-pdf-invoice-image-logo-size/

 

In my version 1.4.7.0 on line 156,

 

if (file_exists(_PS_IMG_DIR_.'/logo_invoice.jpg'))

{

if ($this->_isPngFile(_PS_IMG_DIR_.'/logo_invoice.jpg'))

$this->Image(_PS_IMG_DIR_.'/logo_invoice.jpg', 10, 8, 0, 15, 'PNG');

else

$this->Image(_PS_IMG_DIR_.'/logo_invoice.jpg', 10, 8, 0, 15);

}

elseif (file_exists(_PS_IMG_DIR_.'/logo.jpg'))

{

if ($this->_isPngFile(_PS_IMG_DIR_.'/logo.jpg'))

$this->Image(_PS_IMG_DIR_.'/logo.jpg', 10, 8, 0, 15, 'PNG');

else

$this->Image(_PS_IMG_DIR_.'/logo.jpg', 10, 8, 0, 15);

}

 

This code doesn’t look right to me,

if ($this->_isPngFile(_PS_IMG_DIR_.'/logo_invoice.jpg'))

 

Shouldn’t that be .png and not .jpg?

 

Anyway, hope this helps you.

Link to comment
Share on other sites

Thanks, found it and replaced jpeg for png yet I get back the following message:

 

FPDF error: Alpha channel not supported: /home/content/13/8897513/html/tienda/img//logo.png

 

So it does indeed make the change and displays it as .png but with that warning. I thought the two backslashes [//] before logo.png were screwing things up so I changed them on the code and now it displays:

 

FPDF error: Alpha channel not supported: /home/content/13/8897513/html/tienda/img/logo.png

 

So I have no clue as what to do next!

Link to comment
Share on other sites

Well, I guess you need to use the jpg, but experiment with changing the last two numbers and see if you can stop your logo from stretching.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...