1
script_fu
Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error

I have light box set up with the extgallery module. I also have the extgallery hook hack in place. The extgallery hook hack has been expanded to also work in the news module and cbb.

Here is the problem when in a news cat displaying a [gallery title=gallery tag]1[/gallery] (gallery tag). The news module errors when trying to create a pdf document.

The full error of my example is...

TCPDF error: Unsupported image type: php?id=1

This error has the same number of the tag from the extgallery picture. See above gallery tag number.

How can we fix this? I really need to generate a pdf from the news module with gallery tags/pictures.

2
Will_H
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error
  • 2008/2/1 21:41

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


Sounds like you are going to need to hack the image function. Because the hook hack loads hook-photo.php you will essentially need to add this as an allowable image type.

Also, god knows what version of tcpdf we use with xoops.

When this all boils down to completion it is going to land on the shoulders of the module dev. An image should always be output in a reusable format.

3
script_fu
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error

Okay a little more info.

In order for the lightbox hack to work system wide. You need to hack two files with Zoullou code. Zoullou only tells you to hack one file.

/class/module.textsanitizer.php

But to get it working in news and other modules you also need to place the code here.

/Frameworks/textsanitizer/module.textsanitizer.php

So now we know how to get lightbox working we need to figure out which file it is that needs to be modified.


Here is the url of the pdf which is made from a news story.

/modules/news/pdf/pdf.php?storyid=1

Here is the question... Which file would you mod to fix the gallery tag issue with pdf's.

Also if there is no work around. How could you exclude the gallery tag from the pdf. Meaning is there some code that will block the gallery tag when you click on generate pdf?

4
Will_H
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error
  • 2008/2/1 21:52

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


Quote:

Okay a little more info.

In order for the lightbox hack to work system wide. You need to hack two files with Zoullou code. Zoullou only tells you to hack one file.

/class/module.textsanitizer.php

But to get it working in news and other modules you also need to place the code here.

/Frameworks/textsanitizer/module.textsanitizer.php

So now we know how to get lightbox working we need to figure out which file it is that needs to be modified.


ok, one i said that months ago.... I even made a big fancy post on z's site about it..
two, you even reading my posts?

This has nothing to do with tcpdf, the script has its own limitations. php is not a recognizable image format so the script rejects it. You will need to get hook-photo.php to output a standard image format... jpg preferably.

5
Will_H
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error
  • 2008/2/1 22:09

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


There is a bright side however.

tcpdf is not the only solution.

xhtml2pdf is allegedly good, and there is also the concept of using css to create a printable page.

CSS would probably be the simplest to implement. As it is essentially just copying your current css file and adding visibility: hidden; to all the aspects that you want hidden for printing. Then edit the template for news to load that css file instead of loading the pdf converter.

6
script_fu
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error

Hey I was posting when you were post Will. So no I didn't even read what you posted... lol

Now that I have read im still not sure thats the right answer.

I think the problem could be with the bbcode needed by the gallery tags in order to work with xoops. Remember the pictures will not work in a custom block unless you select the bbcode box.

Here is another interesting thing that Mcdonald just posted. Tcpdf was just up dated two weeks ago or so. It now supports .gif .jpg and .png according to their new release.

But this package is a little out of my range to download. Its 6 megs plus... It would take hours to get of my desk top at 26.3k.

7
Will_H
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error
  • 2008/2/1 22:26

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


dude... php is not an image type.

Just like before tcpdf did not support gif because it costs money to support gif.

It has nothing to do with bbcode... thats ludicrous. Right click one of the thumbs and look at the image properties man.

Then open up Irfanview and try to save anything as php.

php != image.

Solution = Get module dev to output images in usable format.

Regardless of what version we are using that doesn't make php an image type.

8
script_fu
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error

So Will you saying the problem is in the

extgallery/hook-thumb.php

<?php
// $Id$
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <https://xoops.org/>                             //
// ------------------------------------------------------------------------- //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //

require '../../mainfile.php';
include_once 
XOOPS_ROOT_PATH.'/modules/extgallery/class/publicPerm.php';

if(!isset(
$_GET['id'])) {
    
$photoId 0;
} else {
    
$photoId intval($_GET['id']);
}

$photoHandler xoops_getmodulehandler('publicphoto''extgallery');
$photo $photoHandler->get($photoId);

switch(
strtolower(strrchr($photo->getVar('photo_name'), "."))) {
    case 
".png"$type "image/png"; break;
    case 
".gif"$type "image/gif"; break;
    case 
".jpg"$type "image/jpeg"; break;
    default: 
$type "application/octet-stream"; break;
}

$permHandler ExtgalleryPublicPermHandler::getHandler();
if(
$permHandler->isAllowed($xoopsUser'public_access'$photo->getVar('cat_id'))) {
    
$photo $photoHandler->objectToArray($photo);

    
header ("Content-type: ".$type."");
    
readfile(XOOPS_ROOT_PATH."/uploads/extgallery/public-photo/thumb/thumb_".$photo['photo_name']);
} else {
    
header ("Content-type: ".$type."");
    
readfile(XOOPS_ROOT_PATH."/modules/extgallery/images/not-allowed.jpg");
}

?>


I see some stuff in there but will need to study it a little.


Now about the other point you made. You not 100% on the TCPDF issue. I am still having problems with pdf generation in other places in the news that does not have the gallery tags in them. If you have a .gif file in a news story I don't care what you do you cannot make a .pdf period. Maybe the new release of tcpdf has fixed this issue.

9
script_fu
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error

When trying to save a extgallery thumbnail inside of a news story the file extension is hook-thumb.php.jpg

For god sakes how the hell can that be fixed and still work?

What a mess...

10
Will_H
Re: Lightbox, gallery tags, news 1.56 & Pdf problems with TCPDF error
  • 2008/2/1 23:05

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


sure you can, you just have to add a few lines to the imagemanager to make the script think its a png.

Or if you need gif support that bad, you can update your tcpdf. As they have finally added gif support.

Again, php != image format man.

Zhollou will need to rethink his script if he wants extgal to work with all XOOPS functions. What you need to do is stroll over to HIS website and post a bug report.

This has nothing to do with the XOOPS core. It is his module that is causing your problem.

if you look in the uploads directory the images are not stored as php

Login

Who's Online

187 user(s) are online (116 user(s) are browsing Support Forums)


Members: 0


Guests: 187


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits