Vote to Improve PrestaShop

PrestaShop Forum: Build a free online shop. Count on the Community!

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum: Build a free online shop. Count on the Community!

Jump to content

Photo

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

FPDF

  • Please log in to reply
9 replies to this topic
ccollins

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts

Posted 24 March 2012 - 12:22 AM

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

  • Guests

Posted 24 March 2012 - 01:59 AM

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.

ccollins

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts

Posted 24 March 2012 - 08:36 PM

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.
  • likes this

tivicrdotcom

    PrestaShop Apprentice

  • Members
  • PipPip
  • 209 posts

Posted 09 April 2012 - 10:54 PM

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?

  • Guests

Posted 10 April 2012 - 02:34 AM

I have not tested this, but according to this post, you can make the size change in directory - classes - file pdf.php
http://www.prestasho...mage-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.

tivicrdotcom

    PrestaShop Apprentice

  • Members
  • PipPip
  • 209 posts

Posted 10 April 2012 - 02:50 AM

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!

  • Guests

Posted 10 April 2012 - 02:57 AM

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

tivicrdotcom

    PrestaShop Apprentice

  • Members
  • PipPip
  • 209 posts

Posted 10 April 2012 - 03:21 AM

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!

  • Guests

Posted 10 April 2012 - 03:37 AM

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.

tivicrdotcom

    PrestaShop Apprentice

  • Members
  • PipPip
  • 209 posts

Posted 10 April 2012 - 03:41 AM

Yeah Thanks bdalton, I guess going back to the jpg and resizing done on the script will work. Thanks and God Bless!
  • likes this





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users