Elxis CMS Forum

Extensions => Tools => Topic started by: ks-net on October 27, 2008, 19:37:06

Title: PDF error! [SOLVED]
Post by: ks-net on October 27, 2008, 19:37:06
URI: index2.php?option=com_content&do_pdf=1&id=50
 Path: /includes/tcpdf/tcpdf.php
 Line: 3131
 getimagesize(/XXXXXX/XXXXX.gr/html/includes/tcpdf//images/stories/ksworlwide_400.jpg) [function.getimagesize]: failed to open stream: No such file or directory

errors appear only if an image is in article else pdf convert works...

this double slash must break things down.

where to look and what to fix?
Title: Re: PDF error!
Post by: datahell on October 27, 2008, 23:32:50
Try the following:
open includes/tcpdf/config/tcpdf_config.php
go to line 69
change the K_PATH_IMAGES constant to:

define ("K_PATH_IMAGES", $mainframe->getCfg('absolute_path').'/images/');

Tell me if the problem was solved.

Try also with:
define ("K_PATH_IMAGES", $mainframe->getCfg('absolute_path').'/');
Title: Re: PDF error!
Post by: Farhad Sakhaei on October 28, 2008, 11:26:51
Hi , I think that your problem is not related to the TCPDF ,
Try to edit your picture url , Just check if your picture address is like this : http://www.sample.com/images/stories/ksworlwide_400.jpg
Not this : /images/stories/ksworlwide_400.jpg

Good luck ;)
Title: Re: PDF error!
Post by: datahell on October 28, 2008, 11:37:05
Farhad we better try to fix tcpdf even if the image has been entered with a relative path.
As a solution we could make tcpdf to replace the relative path with the full path in this occasion.
Please check my P.M.
Title: Re: PDF error!
Post by: Farhad Sakhaei on October 28, 2008, 11:40:05
Yes John , I am trying ...
Title: Re: PDF error!
Post by: Farhad Sakhaei on October 28, 2008, 12:20:38
Ok, I found the solution ...
Ignore all the last posts and do this :

Download attached file , Extract it and Replace the extracted file with file : \includes\tcpdf\config\tcpdf_config.php
----------------------------------------------------------------------------------------------------------------------------------
OR:
--------------------------------------------------
Edit \includes\tcpdf\config\tcpdf_config.php:
Replace :    
Code: [Select]
define ("K_PATH_MAIN", $mainframe->getCfg( 'absolute_path' ).SEP."includes".SEP."tcpdf".SEP);With:
Code: [Select]
define ("K_PATH_MAIN", $mainframe->getCfg( 'absolute_path' ).SEP);
and

Replace :
Code: [Select]
define ("K_PATH_FONTS", K_PATH_MAIN."fonts".SEP);With:
Code: [Select]
define ("K_PATH_FONTS", K_PATH_MAIN.SEP."includes".SEP."tcpdf".SEP."fonts".SEP);
Tell me the result , Now you can use both relative and absolute image path :)

[attachment deleted by admin]
Title: Re: PDF error!
Post by: datahell on October 28, 2008, 12:58:44
Test the above solution with various images (relative and absolute paths in various directories) and tell me if it always works.
If yes, we will added it to Elxis main release.

Farhad if you change the "K_PATH_MAIN" the script wont have problem including needed libraries? I think that you should only modify the "K_PATH_IMAGES" configuration parameter (I have nt tested it).
Title: Re: PDF error!
Post by: anacon on October 28, 2008, 13:03:46
Is working now. I make test.
Title: Re: PDF error!
Post by: Farhad Sakhaei on October 28, 2008, 13:17:20
Here is a complete test :
http://www.parsmizban.com/salam.html

Just a picture in another site that included in the page can't be include in the exported PDF , This is normal because the TCPDF can't access to the actual file resource ...

Check it fast , Because it is on my live site :D
I'll remove it tonight
Problem solved !
Title: Re: PDF error!
Post by: datahell on October 28, 2008, 13:23:31
OK, seems its working fine. I will also test it later and add it to Elxis.
Thanks farhad!
Title: Re: PDF error! [SOLVED]
Post by: datahell on October 29, 2008, 08:06:14
I added it the above solution in Elxis main release. 2 more things to pay attention:
1. The logo.png image is now taken from the main images/ directory and not from includes/tcpdf/images/ directory. So make sure there is always a "logo.png" file inside your images/ directory.
2. A fix for the blank image constant:
define ("K_BLANK_IMAGE", K_PATH_MAIN.SEP."includes".SEP."tcpdf".SEP."images".SEP."_blank.png");

Now everything is fine.
Title: Re: PDF error! [SOLVED]
Post by: Amigamerlin on October 29, 2008, 09:50:17
I added it the above solution in Elxis main release. 2 more things to pay attention:
1. The logo.png image is now taken from the main images/ directory and not from includes/tcpdf/images/ directory. So make sure there is always a "logo.png" file inside your images/ directory.
2. A fix for the blank image constant:
define ("K_BLANK_IMAGE", K_PATH_MAIN.SEP."includes".SEP."tcpdf".SEP."images".SEP."_blank.png");

Now everything is fine.

Is this fix valid for 2008.0 release and How to fix it?

Thanks
Title: Re: PDF error! [SOLVED]
Post by: datahell on October 29, 2008, 11:38:15
Yes, if you only modify the config file of tcpdf I guess it will work fine.
Title: Re: PDF error! [SOLVED]
Post by: Farhad Sakhaei on October 29, 2008, 11:59:57
OK John , Thank you

To Amigamerlin :
TCPDF of 2008.0 is an old version , You can replace the folder of tcpdf to 2008.1 one ... It will be update to newer version , Then you can replace the config file that I attached ...  :)
Title: Re: PDF error! [SOLVED]
Post by: Amigamerlin on October 30, 2008, 08:22:58
OK John , Thank you

To Amigamerlin :
TCPDF of 2008.0 is an old version , You can replace the folder of tcpdf to 2008.1 one ... It will be update to newer version , Then you can replace the config file that I attached ...  :)

Thank you you all Farhad and John  !!