VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: EIF on June 24, 2013, 15:13:11 PM

Title: TCPDF huge cache
Post by: EIF on June 24, 2013, 15:13:11 PM
Some how the last days the TCPDF cache folder (libraries) is increased a lot. A lot of cache files (about 45000) with names like mska_2cd8302fc91247ca0cad5f00c44b86c3 are stored.
What is this and how can I delete this cache files automatically?

Using Joomla 2.5.11 and Virtuemart 2.0.20b

Title: Re: TCPDF huge cache
Post by: Milbo on June 24, 2013, 22:14:49 PM
Interesting, in fact a question for the tcpdf guys, we just use their library, we do not write it.
Title: Re: TCPDF huge cache
Post by: EIF on June 25, 2013, 11:49:35 AM
I just check the cache again, but the folder is still empty now.
I will ask those tcpdf guys. If it happens again or/and I have a solutions or cause, then I will report it here.
Title: Re: TCPDF huge cache
Post by: Milbo on June 26, 2013, 01:25:00 AM
sounds good.
Title: Re: TCPDF huge cache
Post by: hardwared on October 05, 2013, 08:05:51 AM
I am also getting similar issues, have tracked it down to the likes of Googlebot somehow requesting the product details pdf view instead of html as it crawls your site.

As to where google gets its information from about the availability of the pdf view I am unsure as I have the "show PDF icon" disabled

to help prevent my site from getting shut down for now i have made the following change to virtuemart (2.0.22c):

Edit:  components/com_virtuemart/controllers/productdetails.php  (starting at line 43)

Before:

                if ($format == 'pdf') {
                        $viewName = 'Pdf';
                } else {
                        $viewName = 'Productdetails';
                }


After: 

                /* if ($format == 'pdf') {
                        $viewName = 'Pdf';
                } else { */
                        $viewName = 'Productdetails';
                // }

This does break links for product detail pdf views which is not the nicest option.

Should be a way that I can redefine $format or $viewName and have the html view displayed regardless. 

(even better check for presence of vmconfig "show pdf icon" and toggle based on that)

P.S.  This looks to be something going back for a while now ...  https://forum.virtuemart.net/index.php?topic=109442.0

Topic: TCPDF overloading the server

Can only hope this info helps others :)

Title: Re: TCPDF huge cache
Post by: AH on October 05, 2013, 10:05:54 AM
What do you have for the view lnk in your default.php product template, is pdf still an option?
Title: Re: TCPDF huge cache
Post by: hardwared on October 05, 2013, 11:08:55 AM
Joomla! 2.5.14
Virtuemart: 2.0.22c
PHP Version: 5.3.27

I don't believe so just checked views/productdetails/tmpl/default.php

(i am currently using the stock virtuemart templates for nearly most of the shop)

Hutson: when you say "view link", what exactly are you referring to ?

I dont have any "View Links" as such unless you are referring to "Product Details" which i believe i only have within a Category view.

Within the Product Details Page, i don't really have any view links either. Have also inspected the output to the web browser and cant find anything that would cause googlebot to want to follow products somewhere within my shop in PDF view which i dont believe virtuemart/joomla provided it any hints on how to get there ...

Title: Re: TCPDF huge cache
Post by: jjk on October 05, 2013, 12:31:33 PM
Eventuall you could add the following line to your robots.txt file:
Disallow: /*.pdf$

This should keep Google away from crawling anything that ends with .pdf
Title: Re: TCPDF huge cache
Post by: hardwared on October 07, 2013, 05:02:28 AM
Thanks jjk, 

but this seems to only affect googlebot itself and not all of google's bot types and also the likes of msnbot and others.

Here is what I have done in the end so far with no-side affects assuming i have any real pdf files available for download / linking to via [ /pdf ] ( a directory i have created in the joomla html root )

This gives the behavior of redirecting all pdf views back to html view without having to modify components/com_virtuemart/controllers/productdetails.php as in my earlier post.   

Modified  .htaccess to include the following starting after:  ## Begin - Custom redirects


RewriteCond %{THE_REQUEST} ^[GET]+\s([^\s]+)\.pdf(\?|\s)
RewriteCond %{REQUEST_URI} !^/pdf/(.*)$
RewriteRule .* %1.html [R=301,L]




Title: Re: TCPDF huge cache
Post by: hotrod on February 14, 2014, 03:00:51 AM
Sorry but I just found this after posting a question about it.. can I delete all the files in this cache folder?
Title: Re: TCPDF huge cache
Post by: aagios on January 22, 2015, 10:55:00 AM
In the following path:

public_htm/libraries/tcpdf/tcpdf.php

In this file (tcpdf.php) make a change.

For me it was the 8724 line that says:

$imga->setImageFormat('png');
   $imga->writeImage($tempfile_plain);
   } elseif (function_exists('imagecreatefrompng')) { // GD extension
   // generate images

Change it and put it instead of png -> jpg

$imga->setImageFormat('jpg');
   $imga->writeImage($tempfile_plain);
   } elseif (function_exists('imagecreatefrompng')) { // GD extension
   // generate images

Thats it. After this
No longer being produced brazenly files in cache of TCPDF.