Jump to content
  • 0
ccollins

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

Question

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

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0
Guest   
Guest

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.

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

Re-uploading a .jpeg logo does solve the issue but there's got to be a way to be able to use PNG images because the invoice picture when used as .jpeg looks distorted (stretched). Anyone know what file to tweak?

Share this post


Link to post
Share on other sites
  • 0
Guest   
Guest

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.

Share this post


Link to post
Share on other sites
  • 0

Bdalton thanks for the reply and yout time. It does make a lot of sense, where exaclty is this pdf.php file located at? Is it under a module? I am running on 1.4.6.2. Thanks again.

 

Greetings from Costa Rica!

Share this post


Link to post
Share on other sites
  • 0
Guest   
Guest

I'm using 1.4.7.0 in that version it is in the Classes directory and the file is called pdf.php.

Share this post


Link to post
Share on other sites
  • 0

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!

Share this post


Link to post
Share on other sites
  • 0
Guest   
Guest

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.

Share this post


Link to post
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

×