tip: free gif to png PHP class
Author: Chris Hayes 
Date:   07-28-03 15:52


I have seen several people here asking for the fpdf class to support gif images.

I found a gif to png converter I thought others might want to use. With this one you first convert the gif to a png file (with PHP code) and then fpdf incorporates the png file. Olivier, maybe you can use parts of it for fpdf 1.6?

As far as I can see there are no gotcha's: it seems not to use the GD (GD is a PHP function library for images that is not included in all PHP installations) , and the maker only asks you to keep his (c) notice in the code, no fee.

I found the link on http://nl3.php.net/imagecreatefromgif, you may want to have a look at what the author writes (look for the user comment by "fezber at yamasoft dot com").

I just incorporated it in my fpdf-using files and it worked with two tests i did. I have no final opinion on speed and quality yet but for now i see no problems.

Caching
I wanted to find a way to not have to do the conversion every time (processor time) so I decided to save the created png files, and reuse them the next time. I did not want to write the png files next to the original gif files because my server hosts on safe mode, so I decided to put it all in one directory. To prevent filename collisions i make new filenames with md5(filepath/filename.gif). One could also str_replace the \ with a _. NB my simpe script does not note a file date change, maybe i should include a file date & size in the md5.

The $rootdir I use in the example below is not vital, if your class is on a stable location. I am still shoving mine around so i need it on my site.
Don't forget to make the $pngpath dfirectory writable.

------------------------------------------------------------
$image='image.gif';


$rootdir = substr(__FILE__,0, strpos(__FILE__,'modules')) ;
//note: modules is the place to chop off the __FILE__ path in my situation. others may need to use another border to find the filepath root.

$imgfile=$rootdir.$image;
if (substr($imgfile,-3)=='gif')
{ $pngpath='modules/hypertable/inc/fpdf/gif/png/';
$pngfile=md5($imgfile).'.png';
if (!(file_exists($dir.$pngpath.$pngfile)))
{include($rootdir."gif.php");//gif.php=conversion class
$gif = gif_loadFile($imgfile);
if($gif) { gif_outputAsPNG($gif,$rootdir.$pngpath.$pngfile );
}
}
$imgfile=$rootdir.$pngpath.$pngfile;
}

//now i have yet to find an elegant way to set the size automatically. the max values are not in use yet.
$maxwidth=100;
$maxheight=100;
$size_array = getimagesize ($imgfile);
$width=$size_array[0]/4;
$heigh= $size_array[1]/4;


$this->Image($imgfile,10,10,$width,$height);

 RE: tip: free gif to png PHP class
Author: Chris Hayes 
Date:   07-28-03 16:06

Olivier, fyi: 'IHDR' - 'PLTE' :)

 RE: tip: free gif to png PHP class
Author: Olivier 
Date:   07-28-03 22:41

Interesting, I didn't know this class... It's actually a LZW decompressor written in PHP.
This must be a bit slow, however, and to embed GIFs in a PDF, it's not necessary to uncompress the data, because PDF supports LZW. Unfortunately, the way bits are organized is quite different, and it's difficult to rearrange them in the correct order. This is why I don't support GIF yet, but I had planned to study it again when I have the time.

By the way, since PHP4.3.0, GD can read GIFs again. GD is not installed everywhere indeed, but is very common.
Another related remark: LZW patent has just expired in the US.

>fyi: 'IHDR' - 'PLTE'

Er, didn't get this one... Is there a joke with these PNG tags?

 RE: tip: free gif to png PHP class
Author: Chris 
Date:   07-28-03 23:19

not really a joke, but i noticed there are different types of gifs and pngs and i browsed through that class and through fpdf a bit and noticed that they both 'knew' these abbreviations, so i thought that must be a good sign.

I have no idea about the compression of images. This class is not very fast, as you say.

 RE: tip: free gif to png PHP class
Author: qlp 
Date:   08-05-03 15:05

Here do y put the code to work?

in the fpdf.php?

Thanks

 RE: tip: free gif to png PHP class
Author: Chris 
Date:   08-16-03 12:25

In my own extended fpdf class I have this piece of code. I am not a pro coder though. Adapt the paths to your situation.

$rootdir = substr(__FILE__,0, strpos(__FILE__,'modules')) ;

$imgfile=$rootdir.$a2[1];
if (substr($imgfile,-3)=='gif')
{ $pngpath='modules/hypertable/inc/fpdf/gif/png/';
$pngfile=md5($imgfile).'.png';

if (!(file_exists($dir.$pngpath.$pngfile))) //check whether gif is already converted!
{include($rootdir."modules/hypertable/inc/fpdf/gif/gif.php");//conversion class
$gif = gif_loadFile($imgfile);
if($gif) { gif_outputAsPNG($gif,$rootdir.$pngpath.$pngfile );}
}
$imgfile=$rootdir.$pngpath.$pngfile;
}
//echo $imgfile;
$size_array = getimagesize ($imgfile);
$maxwidth=100;
$maxheight=100;
$width=$size_array[0]/4;
$height=$size_array[1]/4;


$this->Image($imgfile,$this->GetX(),$this->GetY(),$width,$height);
//$this->Write(5, $this->GetY());
$this->SetY($this->GetY()+$height);

 RE: tip: free gif to png PHP class
Author: Jérôme Fenal 
Date:   08-17-03 22:35

OK, done it.

Add :

elseif($type=='gif') $info=$this->_parsegif($file);

at about line 922 in fpdf.php

And add this private function where you want (after _parpng ?) :

function _parsegif($file)
{
require_once "gif.php"; // GIF class in pure PHP from Yamasoft (http://www.yamasoft.com)

$h=0;
$w=0;

$gif= new CGIF();

if (!$gif->loadFile($file, 0)) {
$this->Error("GIF parser : unable to open file $file");
}

if($gif->m_img->m_gih->m_bLocalClr) {
$nColors = $gif->m_img->m_gih->m_nTableSize;
$pal = $gif->m_img->m_gih->m_colorTable->toString();
if($bgColor != -1) {
$bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor);
}
$colspace='Indexed';
} elseif($gif->m_gfh->m_bGlobalClr) {
$nColors = $gif->m_gfh->m_nTableSize;
$pal = $gif->m_gfh->m_colorTable->toString();
if($bgColor != -1) {
$bgColor = $gif->m_gfh->m_colorTable->colorIndex($bgColor);
}
$colspace='Indexed';
} else {
$nColors = 0;
$bgColor = -1;
$colspace='DeviceGray';
$pal='';
}

$trns='';
if($gif->m_img->m_bTrans && ($nColors > 0)) {
$trns=array($gif->m_img->m_nTrans);
}

$data=$gif->m_img->m_data;
$w=$gif->m_gfh->m_nWidth;
$h=$gif->m_gfh->m_nHeight;

if($colspace=='Indexed' and empty($pal))
$this->Error('Missing palette in '.$file);

$gif='';

if ($this->compress) {
$data=gzcompress($data);
// Attention :
// - on vient de recompresser de façon globale les données de l'image
// GIF, il n'y a donc plus lieu d'utiliser une quelconque prediction
// au décodage Flate du PDF -> Predictor=1 et non plus 15
// - bpc=8 dans tous les cas car décodage du GIF à raison de 1 pixel par octet
// - Colors=1 car GIF toujours sur 8 bits maxi (en couleur et niveaux de gris)
return array( 'w'=>$w, 'h'=>$h, 'cs'=>$colspace,
'bpc'=>8, 'f'=>'FlateDecode',
'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
} else {
return array( 'w'=>$w, 'h'=>$h, 'cs'=>$colspace,
'bpc'=>8, 'pal'=>$pal, 'trns'=>$trns,
'data'=>$data);
}
}

 RE: tip: free gif to png PHP class
Author: Jérôme Fenal 
Date:   08-17-03 22:39

Did I forgot to say that is uses Yamasoft GIF PHP class (http://www.yamasoft.com/php-gif.zip) ?

Oh, actually yes, I did. You just need to have the 'gif.php' file in the same directory as fpdf.php, and it will work like a charm, except for multipart GIF files (but how do you show an anime in PDF ?).

Regards,

Jérôme

 RE: tip: free gif to png PHP class
Author: enrico 
Date:   11-12-03 15:31

Hy,

i'll try to insert the Jérôme Fenal's code into the pdf class file, but i don't work (tell me that have a problem with the document an dinsert a grey image - not the original)

i'll have modify the file class for support insert image from web utl (suggest posted in this forum)
// original
// $data=fread($f,filesize($file));
// new for web url image support
while(!feof($f)) {
$data = $data . fread($f, 1024);
}
// end new

It's possible have the complete archive for testing it ??

Thanks

Enrico

 RE: tip: free gif to png PHP class
Author: Olivier 
Date:   11-12-03 23:20

I uploaded a patched version of the class here. It works for me with a local GIF.
If you want to include a remote GIF, you'll have to modify the loadFile() method in gif.php because it uses filesize().

 RE: tip: free gif to png PHP class
Author: enrico 
Date:   11-13-03 09:20

Thanks Oliver,

you'll think that with this modification,

// original
// $data=fread($f,filesize($file));
// new for web url image support
while(!feof($f)) {
$data = $data . fread($f, 1024);
}
// end new

the class dowload and parse the gif file from a remote url ?

Thanks

Enrico

 RE: tip: free gif to png PHP class
Author: Olivier 
Date:   11-13-03 21:29

This is the idea, but the loadFile() method uses other variable names.

 RE: tip: free gif to png PHP class
Author: enrico 
Date:   11-18-03 10:06

Thanks oliver,

could you help me to write it in the rigt way ?

i'm not a vey expert of php :(

Thanks.

Enrico

 RE: tip: free gif to png PHP class
Author: Franz Skaaning 
Date:   01-26-04 01:26

I see the nice work being done here. I am new to FPDF.

The updated file I see from this string is from version 1.51, and I am using 1.52. Did anyone update this or is that not needed?

 RE: tip: free gif to png PHP class
Author: Olivier 
Date:   01-26-04 22:26

Just add the _parsegif() method to the class (or to your own inherited one), you have nothing more to do with 1.52.

 RE: tip: free gif to png PHP class
Author: Franz Skaaning 
Date:   01-26-04 22:47

Thanks for the answer.

I needed :
elseif($type=='gif')
$info=$this->_parsegif($file);

as well.

 RE: tip: free gif to png PHP class
Author: Khee Wei Seow 
Date:   02-19-04 04:12

I managed to do the gif stuff in linux but not in Windows environment. Anyone knows why?

Guess it has to do with the gif.php?

Thanks!

 RE: tip: free gif to png PHP class
Author: Khee Wei Seow 
Date:   02-19-04 04:17

Btw, I gets a "There was a problem reading this docuement (40)" after Acrobat loads...


Thanks!

 RE: tip: free gif to png PHP class
Author: Olivier 
Date:   02-19-04 22:02

The script works on Windows too.. No idea what happens for you.

 RE: tip: free gif to png PHP class
Author: Khee Wei Seow 
Date:   02-20-04 02:10

Thanks for the info Olivier. I'll do my own tracing then....


Thanks!

 RE: tip: free gif to png PHP class
Author: Olivier 
Date:   03-06-04 18:26

Another user had the same problem and finally I discovered that it happens when Zlib is not available. Either add Zlib to your configuration or add this line:

if(isset($info['f']))

just before:

$this->_out('/Filter /'.$info['f']);

in the _putimages() method.

 RE: tip: free gif to png PHP class
Author: cla 
Date:   03-27-04 18:08

where i can download the class with gif support thath works fine?

 RE: tip: free gif to png PHP class
Author: Cedric 
Date:   05-16-04 05:49

Hy,

fpdf is very usefull, thanks for it.
It's true that with gif it will be great. I tried all what is write in this page, and I get an error:
Undefined variable: bgColor in <b>c:\...\fpdf.php</b> on line <b>1596
Undefined variable: bgColor in <b>c:\...\fpdf.php</b> on line <b>1597
Undefined property: m_bTrans in <b>c:\...\fpdf.php</b> on line 1608

So someone could help me, if it's not an beginner error.

 RE: tip: free gif to png PHP class
Author: Olivier 
Date:   05-17-04 23:13

That's right, there are some uninitialized variables in the script, never noticed them... The code should be cleaned up (or remove error_reporting(E_ALL) to suppress the warnings).

 RE: tip: free gif to png PHP class
Author: Florent G. 
Date:   06-03-04 11:56

Sorry but i still didn't understand what i finally have to change or update to support GIF files ?

could someone publish a summary of all changes needed ?

thanks

Florent

 RE: tip: free gif to png PHP class
Author: Paysan 
Date:   07-30-04 17:15

I do not have Zlib added to my configuration but I added the line "if(isset($info['f']))" to the _putimages method. Nevertheless Acrobat Reader isn't able to read the created pdf file. If I try to open the document right out of my IE, the pure code of the pdf document is shown.

What's my mistake?

 RE: tip: free gif to png PHP class
Author: Edouard 
Date:   08-18-04 11:29

Hi,

First of all, thanks for the great job that has been done on FPDF, it is very useful.
However I am trying to add GIF support following the given instructions... but I miss the gif.php file (from www.yamasoft.com).
In fact the site seems to be down, I can't reach it!
Does anyone know where I could get the file?

Thanks!

 RE: tip: free gif to png PHP class
Author: Franz Skaaning 
Date:   08-18-04 20:33

Its also here:

http://html2fpdf.sourceforge.net/

 RE: tip: free gif to png PHP class
Author: Edouard 
Date:   08-19-04 18:52

Thanks a lot for your help

 RE: tip: free gif to png PHP class
Author: Olivier 
Date:   09-19-04 12:58

I uploaded the Yamasoft archive here (the site seems to be definitively closed).

 RE: tip: free gif to png PHP class
Author: Mark 
Date:   11-12-04 17:22

Little bug to report.
Drove me nuts for awhile since it was only giving me fatal errors once in 500... Then I realized the error was occuring for a specific .gif only

In the following method:
function _parsegif($file)
{
<snip>
if($gif->m_img->m_gih->m_bLocalClr) {
$nColors = $gif->m_img->m_gih->m_nTableSize;
$pal = $gif->m_img->m_gih->m_colorTable->toString();
if($bgColor != -1) {
$bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor);
}
$colspace='Indexed';
}
<snip>

should be (notice the line after: "if($bgColor != -1) {". Change $this-> to $gif->):
if($gif->m_img->m_gih->m_bLocalClr) {
$nColors = $gif->m_img->m_gih->m_nTableSize;
$pal = $gif->m_img->m_gih->m_colorTable->toString();
if($bgColor != -1) {
$bgColor = $gif->m_img->m_gih->m_colorTable->colorIndex($bgColor);
}
$colspace='Indexed';
}

Cheers!

 RE: tip: free gif to png PHP class
Author: Xavier 
Date:   01-13-05 01:26

Olivier talked about the "filesize" function called in the load method in gif.php ;
If you run php 4.3.0 or greater, you can replace all this code :

if(!($fh = @fOpen($lpszFileName, "rb"))) {
return false;
}
$this->m_lpData = @fRead($fh, @fileSize($lpszFileName));
fClose($fh);

with this single line, which works either locally or remotely :

$this->m_lpData = file_get_contents($lpszFileName);

Thanks for the good job !
Xavier - xjimenez@zonatim.com

 RE: tip: free gif to png PHP class
Author: Stéphane 
Date:   06-21-05 17:08

Bonjour,
j'ai implémenté la classe HTML2FPDF qui inclu normalement les gifs, et à chaque fois que je met une image gif, j'ai l'erreur suivante : "Une erreur est survenue lors du traitement d'une page. Une erreur est survenue à la lecture de ce document (40)."
De plus, dès que j'utilise HTML2FPDF, je n'arrive plus à utiliser les header et footer.
Quelqu'un pourrait il m'aider?
Merci

Hello,
I au using HTML2FPDF class, which include normally gif format, but when I put this sort of image in my code, I have this error: "An error occured while treating the page. An error occured while reading this document (40)".
Finally, I have an other problem: when I use HTML2FPDF, I can use footer and header function.
Please help!!

Stéphane

 RE: tip: free gif to png PHP class
Author: Simple Solution 
Date:   07-17-05 03:46

Here is a simple solution to adding gif support to FPDF, just create a new FPDFGIF object instead of a FPDF object.

class FPDFGIF extends FPDF {

function FPDFGIF($orientation='P',$unit='mm',$format='A4'){
parent::FPDF($orientation,$unit,$format);
}

function Image($file, $x, $y , $w=null , $h=null, $type=null, $link=null){
// work out if the image is a gif
$image_type = exif_imagetype($file);
if ($image_type==1){
$tmp_filename = tempnam('/tmp/', 'pdfgif');
$img = imagecreatefromgif($file);
imagepng($img, $tmp_filename);
rename($tmp_filename, $tmp_filename.'.png');
$file = $tmp_filename.'.png';
}
parent::Image($file, $x, $y , $w, $h, $type, $link);
}
}

 RE: tip: free gif to png PHP class
Author: dmiranda 
Date:   08-23-05 02:59

simple solution, would you mind expanding on your suggestion to add gif support to fpdf?
Where do i put that code? how do i call it? thanks!

 RE: tip: free gif to png PHP class
Author: Monkhorst 
Date:   09-01-05 09:53

To make things a little easier for the new:

1 - edit php.ini dynamic extensions section, make sure these lines appear in this order:

; to get exif_imagetype to work for fpdf gif support
extension=php_mbstring.dll
extension=php_exif.dll

2 - restart webserver

3 - edit the Image function as follows (fpdf.php line 898 (v1.53)).

function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
{

// add this code

// work out if the image is a gif
// if so, make it a png
if (exif_imagetype($file) == IMAGETYPE_GIF) {
$tmp_filename = tempnam('/tmp/', 'pdfgif');
$img = imagecreatefromgif($file);
imagepng($img, $tmp_filename);
rename($tmp_filename, $tmp_filename.'.png');
$file = $tmp_filename.'.png';
}

// end added code

//Put an image on the page
if(!isset($this->images[$file]))
{
......etc.

4 - done

 RE: tip: free gif to png PHP class
Author: dmiranda 
Date:   09-02-05 00:45

Just to confirm that Monkhorst' fix does it all. Got a fresh fpdf 1.53, erased all previous changes, and now gifs show well.

 RE: tip: free gif to png PHP class
Author: ste 
Date:   01-12-06 20:13

Other solution (more simply because not edit the php.ini)

-1- Just edit the Image function as follows (fpdf.php line 898 (v1.53)).

function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
{

// add this code

// work out if the image is a gif
// if so, make it a png
$tmp_img = getImageSize($file);

if ($tmp_img[2] == '1') {
$tmp_filename = tempnam('/tmp/', 'gif4fpdf'.md5(uniqid(rand())) );
$img = imagecreatefromgif($file);
imagepng($img, $tmp_filename);
rename($tmp_filename, $tmp_filename.'.png');
$file = $tmp_filename.'.png';
}

// end added code

//Put an image on the page
if(!isset($this->images[$file]))
{
......etc.

-2- hopla, put your file fpdf.php modified on your server ftp, that's run !

 RE: tip: free gif to png PHP class
Author: Martijn Korse 
Date:   01-13-06 15:14

The class seems to have problems with transparant PNGs
When i try to use a transparant PNG in my pdf i get the following error:

FPDF error: Alpha channel not supported: logo.png

While trying to find out if i could fix i noted the following however: when i generate another error by calling an unexisting function, the FPDF Error disappears and the PNG-image appears! With transparancy!

Of course, this is not really a solution as i don't want php-errors on my pdfs

Does anyone know how to solve this properly?

 RE: tip: free gif to png PHP class
Author: Jérôme Fenal 
Date:   01-13-06 15:36

As it is written : FPDF error: Alpha channel not supported: logo.png

So do not use images in PNG format with alpha channel with FPDF.

 RE: tip: free gif to png PHP class
Author: Martijn Korse 
Date:   01-13-06 16:21

I know it apparently is not supported.
But isn't it strange that if i create (another) error, that it dóes show the png and with transparancy?
Well, i just found out there's more ways to create transparancy in png that are supported, so i guess it's not that big a deal.

But given my findings i guess it shouldn't be too hard to support alpha channel .. maybe someone else finds this interesting.

(btw i was using it in combination with html2pdf)

 RE: tip: free gif to png PHP class
Author: mike 
Date:   01-17-06 17:35

so have you been able to use png's with transparency in your pdf's? if so, how did you create the images?

 RE: tip: free gif to png PHP class
Author: Martijn Korse 
Date:   01-17-06 17:47

I downloaded a trail version of PaintShopPro (get it at tucows or something) and this tool allowed me to create the PNGs with using 'single color transparency' instead of 'alpha channel transparency'.
(once you have created the image, go to File >Export > PNG and click on the tab 'Transparency'

 RE: tip: free gif to png PHP class
Author: mike 
Date:   01-17-06 18:07

great, thank you!

 RE: tip: free gif to png PHP class
Author: Rigadin 
Date:   09-05-06 09:58

Thanks Ste for your code to convert gif to png before inserting the image into the pdf document. It works great but... had to add one line to change the type of the image after conversion, otherwise we still call the gif function. So, here is the code with the $type = 'png'; line added:


-1- Just edit the Image function as follows (fpdf.php line 898 (v1.53)).

function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
{

// add this code

// work out if the image is a gif
// if so, make it a png
$tmp_img = getImageSize($file);

if ($tmp_img[2] == '1') {
$tmp_filename = tempnam('/tmp/', 'gif4fpdf'.md5(uniqid(rand())) );
$img = imagecreatefromgif($file);
imagepng($img, $tmp_filename);
rename($tmp_filename, $tmp_filename.'.png');
$file = $tmp_filename.'.png';
$type = 'png';
}

// end added code

//Put an image on the page
if(!isset($this->images[$file]))
{
......etc.

 RE: tip: free gif to png PHP class
Author: Siegfried 
Date:   10-31-06 13:34

There seems to be an error in 'gif.php' when used with PHP 5.x.

In the function 'gif_outputAsPng' the first line is a multiple if-statement. The original reads

if(!isSet($gif) || (@get_class($gif) <> "cgif") || !$gif->loaded() || ($lpszFileName == "")) {

Note that in the part '(@get_class($gif) <> "cgif")' the class name is originally written lower case. This does not throw an error in PHP 3.x or 4.x because case does not matter in the get_class comparison in those PHP versions.

However, in PHP 5.x case does matter in get_class comparisons. Since the class name is in reality 'CGIF' (all upper case) the comparison fails in PHP 5.x.

To eliminate this error just write this line instead

if(!isSet($gif) || (@get_class($gif) <> "CGIF") || !$gif->loaded() || ($lpszFileName == "")) {

Took me quite some time to find this error. Hope its helps somebody.

Siegfried

 RE: tip: free gif to png PHP class
Author: Jakob Stoeck 
Date:   11-02-06 00:14

Don't use the gif.php when you have a GD which supports Gif files (again).

The code from ste with the improvements from Rigadin works really good. Though with transparent gifs I had a „Interlacing not supported“ error.

This error can be removed easily by adding a imageinterlace($img,0) to the code:

// work out if the image is a gif
// if so, make it a png
$tmp_img = getImageSize($file);

if ($tmp_img[2] == '1')
{
$tmp_filename = tempnam('/tmp/', 'gif4fpdf'.md5(uniqid(rand())) );
$img = imagecreatefromgif($file);
imageinterlace($img,0); // added because some transparent gifs mutate to interlaced pngs which throws an error in fpdf
imagepng($img, $tmp_filename);
rename($tmp_filename, $tmp_filename.'.png');
$file = $tmp_filename.'.png';
$type = 'png';
}
// end added code

 RE: tip: free gif to png PHP class
Author: Birgit Smuda 
Date:   12-05-06 10:34

Hallo,

I would like to convert a gif Image and I use the new FPDF class, include the new gif Image functionality. Then a gif Image has to be convert, I’ve got the error message unable to open file x.gif . I don’t now the reason. The gif file is existing. I tried to analysed and I find the interrupt point ( return value false) in function load($data, &$datLen) in gif.php.

It would be great, if someone could help me!

Thanks for your effort!!

Ciao Birgit

 RE: tip: free gif to png PHP class
Author: mathan 
Date:   05-04-08 09:48

please a sample code

 RE: tip: free gif to png PHP class
Author: g_apple 
Date:   05-11-08 16:12

All of the suggestions, tweaks and fixes in this forum have helped me tremendously. I appreciate all the input.

However, I do have a question concerning image size.

When converting an HTML document to PDF, images become at least 50% larger.

I would like to find out how to generate output which leaves the image dimensions the same as in the HTML page.

Does anyone know what I should do or be doing?

Thanks for the help in advance -

- G

 RE: tip: free gif to png PHP class
Author: g_apple 
Date:   05-12-08 23:24

Folks, I found out why the PDF wasn't rendering properly.

The <img> tags need width="" and height="" attributes matching the dimensions of the actual image in pixels.

Since I rely upon CSS for this, I have a habit of leaving the "old school" width and height attributes out of elements.

I hope this helps someone.

- G

 RE: tip: free gif to png PHP class
Author: Clemens 
Date:   05-15-08 08:53

I have a problem with Rigadins solution...I added it to the code and the following occurs when I try to insert a .gif file:
FPDF error: Interlacing not supported: ...
Interlacing is not supported by FPDF, I know, but why does the function create interlaced pngs?
Thanks for any suggestions...
Clemens

 RE: tip: free gif to png PHP class
Author: Clemens 
Date:   05-15-08 08:58

Ah, excuse this silly question...I should rather have read the thread better...I just overlooked Jakob Stoecks post, sorry...

 Reply To This Message
 Your Name:
 Your Email:
 Subject:
Email replies to this thread
  

Phorum 3.2.6