Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Sat Jul 14, 2012 1:51 pm Reply with quote

Is anyone else experiencing any problems with using the 'Save as PDF' function for news articles when the article includes an image. I am currently receiving the following error:

Quote:
TCPDF ERROR: [Image] Unable to get image: [ Only registered users can see links on this board! Get registered or login! ]


I have been trying to solve the problem with the help of Montego, but we've not been able to pin it down.

Any suggestions would be gratefully appreciated.


jakec
 
View user's profile Send private message
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm



Joined: Aug 13, 2009
Posts: 1122

PostPosted: Sat Jul 14, 2012 3:02 pm Reply with quote

I tried to add an image but when I click on the pdf icon to safe as pdf, I get an error on the site. I am coming back with more details, I am testing more things.

Edited: Guys, jakec is right.

If I add an image to the article and I click on the icon to safe as pdf I get no results and my site gets stucked loading without any result. After removing the image then it works again.

Shocked

Strange!


Last edited by hicuxunicorniobestbuildpc on Sat Jul 14, 2012 3:17 pm; edited 2 times in total 
View user's profile Send private message
jakec







PostPosted: Sat Jul 14, 2012 3:15 pm Reply with quote

unicornio, thanks for testing on your site.

What error are you getting?
 
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Sat Jul 14, 2012 4:35 pm Reply with quote

In your site admin preferences, do you have a trailing / on the end of your Site URL?

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
hicuxunicorniobestbuildpc







PostPosted: Sat Jul 14, 2012 5:45 pm Reply with quote

No I don't have that but I will do it if it is necessary.

Edited

I tested with and without the slash and it doesn't work neither Sad

I know why you are asking us that. Result

.com//modules.php?name=News&file=article&sid=2#disqus_thread

If I have the slash / I will not get any result but if I don't put it. I won't get it neither. Nothing is showing. I'm getting Gateway error, blank page
 
nuken







PostPosted: Sat Jul 14, 2012 9:55 pm Reply with quote

I can't reproduce the issue. You may want to try the latest release of TCPDF from here:
[ Only registered users can see links on this board! Get registered or login! ]

You can just copy over the files in classes/tcpdf folder.

The bit of code that is returning the error is in tcpdf.php file:

Code:


if ($imsize === FALSE) {
         if (substr($file, 0, -34) == K_PATH_CACHE.'msk') { // mask file
            // get measures from specified data
            $pw = $this->getHTMLUnitToUnits($w, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
            $ph = $this->getHTMLUnitToUnits($h, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
            $imsize = array($pw, $ph);
         } else {
            $this->Error('[Image] Unable to get image: '.$file);
         }


and that bit of code relies on several functions within tcpdf. Have you tried to use a different image and see if the results are the same? I am wondering if it could be an upload issue with the image.
 
jakec







PostPosted: Sun Jul 15, 2012 4:38 am Reply with quote

Thanks nuken I'm out at the moment, but I'll give this a go tonight.
 
hicuxunicorniobestbuildpc







PostPosted: Sun Jul 15, 2012 5:00 am Reply with quote

nuken, I guess you are right. It has to do with an image. I tested with .jpg image and it worked perfect. I guess this is an issue wiht .png or other images.

I downloaded the file u suggested but I didn't upload it yet until you answer my question to be sure I don't mess anything up.

I noticed I have to remove example forlder but there are more files inside. Can u let us know what exactly I should upload to update the package?

Edited: I decided to update it but it didn't solve any problem. Sad
 
nuken







PostPosted: Sun Jul 15, 2012 5:49 am Reply with quote

Are you sure the image is not the problem? I have had no issues with any image types.

You can upload all the files in the package or just upload the same ones that come with RN. Not all of them are needed but they will not hurt anything.
 
hicuxunicorniobestbuildpc







PostPosted: Sun Jul 15, 2012 6:38 am Reply with quote

The image is the problem, that's what I said. When I load an .png then my site keeps loading and loading and it doesn't respond until a few minutes.

when I load a .jpg then it works properly but not with (png images) Shocked
 
nuken







PostPosted: Sun Jul 15, 2012 8:27 am Reply with quote

You are not following me unicornio. My question was is the image itself messed up.

Give me a link to the image you are having trouble with and I will try it to see if the issue may be server configuration related or image related.
 
hicuxunicorniobestbuildpc







PostPosted: Sun Jul 15, 2012 8:40 am Reply with quote

I can not tell u that because when I click on the icon to safe as a pdf then nothing happens. I get a blank page and the website gets stuck. When I make the story everything goes well and it shows the png image, it is just when I want to safe this document as a pdf.
 
nuken







PostPosted: Sun Jul 15, 2012 9:53 am Reply with quote

nuken wrote:
You are not following me unicornio. My question was is the image itself messed up.

Give me a link to the image you are having trouble with and I will try it to see if the issue may be server configuration related or image related.


I did not ask for an explanation, I asked for the image you are having trouble with so I can test it and see if that is the problem or not.
 
jakec







PostPosted: Sun Jul 15, 2012 2:05 pm Reply with quote

nuken, I am not sure the probel I originally reported is the same as what unicornio is getting.

I've just checked my admin preferences and there is no trailing / on the end of the site URL, so I am sure where the extra / is coming from, but if I cut and paste the filepath then it works without a problem. Confused
 
nuken







PostPosted: Sun Jul 15, 2012 2:10 pm Reply with quote

Are you using a windows server or apache? The reason I say that it that in the tcpdf_config.php, the file path is set in the very top. The slashes may be added there. It looks like this:

Code:


if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {

   // DOCUMENT_ROOT fix for IIS Webserver
   if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) {
      if(isset($_SERVER['SCRIPT_FILENAME'])) {
         $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])));
      } elseif(isset($_SERVER['PATH_TRANSLATED'])) {
         $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])));
      } else {
         // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www')
         $_SERVER['DOCUMENT_ROOT'] = '/';
      }
   }

   // Automatic calculation for the following K_PATH_MAIN constant
   $k_path_main = str_replace( '\\', '/', realpath(substr(dirname(__FILE__), 0, 0-strlen('config'))));
   if (substr($k_path_main, -1) != '/') {
      $k_path_main .= '/';
   }


this maybe where the extra slassh is coming from.
 
jakec







PostPosted: Sun Jul 15, 2012 2:16 pm Reply with quote

It's an apache server.
 
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sun Jul 15, 2012 6:14 pm Reply with quote

The double slash issues is caused by both of these lines in printpdf.php
Code:


//$baseURL = getNukeURL();
//die($baseURL);
$htmlcontent2 = reltoabs($bodytext, $baseURL);

I would recommend:
Code:


global $nuke_config;
$baseURL = $nuke_config['nukeurl'];

That only fixes half the problem. The problem is that the reltoabs() function does not differentiate between links that start with a "/" or not. I could not reproduce the problem, but could see how this might cause it.


unicornio or jakec, in tcpdf.php search for the three lines of:
Code:


$imsize = @getimagesize($file);

Replace with:
Code:


$imsize = getimagesize($file);


Then see what errors are thrown.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
hicuxunicorniobestbuildpc







PostPosted: Sun Jul 15, 2012 7:22 pm Reply with quote

Palbin I don't get any result. the site is getting loading all the time

I added a png images as I said above. This link is for nuken so he can see by himself.

Where is printpdf.php? I can't find it

This is the error I get, for nuken and palbin,

Code:
Gateway Time-out


The gateway did not receive a timely response from the upstream server or application.
 
jakec







PostPosted: Mon Jul 16, 2012 8:26 am Reply with quote

Palbin, thankyou the first set of changes fixed the problem. Smile
 
jakec







PostPosted: Mon Jul 16, 2012 8:27 am Reply with quote

unicornio, printpdf.php file is located under the News module.
 
hicuxunicorniobestbuildpc







PostPosted: Mon Jul 16, 2012 10:21 am Reply with quote

Unfortunatetly it didn't work for me. Now it opens more faster but still blank page and says nothing.


This is what Palbin suggested to do:

Code:
// Arabic and English content

$htmlcontent2 = $bodytext;
global $nuke_config;
$baseURL = $nuke_config['nukeurl'];
//$baseURL = getNukeURL();
//die($baseURL);//Palbin where did you get this line I didn't have this one here. I just added now
$htmlcontent2 = reltoabs($bodytext, $baseURL);
$pdf->WriteHTML($htmlcontent2, true, 0, true, 0);
 
jakec







PostPosted: Mon Jul 16, 2012 11:04 am Reply with quote

unicornio, this is what my code now looks like:

Code:


// Arabic and English content
$htmlcontent2 = $bodytext;
//$baseURL = getNukeURL();
//$htmlcontent2 = reltoabs($bodytext, $baseURL);
global $nuke_config;
$baseURL = $nuke_config['nukeurl'];

$pdf->WriteHTML($htmlcontent2, true, 0, true, 0);
 
hicuxunicorniobestbuildpc







PostPosted: Mon Jul 16, 2012 12:13 pm Reply with quote

I still get a blank page doing this, anyway I will always upload jpg since png doesn't work with me. I guess I have to live with this problem.
 
nuken







PostPosted: Mon Jul 16, 2012 1:21 pm Reply with quote

Turn on error reporting and see what error is being generated.
 
Palbin







PostPosted: Mon Jul 16, 2012 3:11 pm Reply with quote

I guess I should have been more clear. Especially since I left diagnostic code in my last post. What your code should look like now is this:
Code:


// Arabic and English content
$htmlcontent2 = $bodytext;
global $nuke_config;
$baseURL = $nuke_config['nukeurl'];
$htmlcontent2 = reltoabs($bodytext, $baseURL);


jakec, glad your site works with while commenting out the reltoabs() function, but I am unsure of the consequences.

nuken, do you know of a better function for converting links instead of this reltoabs() which apparently comes from nukeSEO. We need something that differentiates between links that start with a / or not.

unicornio, your problem should access or server setup based, but could possibly could be caused by this issue. You need to turn on error reporting as nuken suggests. I know "we" have went over this many times before.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©