Hey All, I'm using the FPDF class to dynamically create PDF files with PHP. So far so good, its a really decent setup, and I'd recommend it to anyone looking to create PDFs. I'm trying to add images. The images I'm trying to add are remotely located on a different site (They are National Weather Service Weather Charts, I'm creating a site for Pilot's to get Weather Briefings). The images are also gifs, which I have modifed FPDF to handle Gifs. My problem comes from the fact they are remote. If someone could take a few minutes and let me know which grouping of php functions I can use to grab the remote image and save it onto my server, it would be greatly appreciated. I'm sure once I get the image locally, I can add it to the PDF. I'm pretty decent with PHP, but I actually havent used many of the file manipulation functions and therefor am fairly lost on how to do the above task. Thanks!
Looking for the same answers. I am working on a website for a travel agency and they want to be able to deliver a Map and directions along with all there trip information inside the pdf. I have been using fpdf for about 3 years on this same website. Let me know if you find a solution. Thanks!
Taken from www.php.net/gd function by office at 4point-webdesign dot com imgcomp is the quality, i turned it around so now its from 0 -best to 100 -most compressed. For gif version just change the functions names. function resampimagejpg($forcedwidth, $forcedheight, $sourcefile, $destfile, $imgcomp) { $g_imgcomp=100-$imgcomp; $g_srcfile=$sourcefile; $g_dstfile=$destfile; $g_fw=$forcedwidth; $g_fh=$forcedheight; if(file_exists($g_srcfile)) { $g_is=getimagesize($g_srcfile); if(($g_is[0]-$g_fw)>=($g_is[1]-$g_fh)) { $g_iw=$g_fw; $g_ih=($g_fw/$g_is[0])*$g_is[1]; } else { $g_ih=$g_fh; $g_iw=($g_ih/$g_is[1])*$g_is[0]; } $img_src=imagecreatefromjpeg($g_srcfile); $img_dst=imagecreate($g_iw,$g_ih); imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $g_iw, $g_ih, $g_is[0], $g_is[1]); imagejpeg($img_dst, $g_dstfile, $g_imgcomp); imagedestroy($img_dst); return true; } else return false; } PHP: