wrapper.php and the method to handle base64 encoded images

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
Helga
Posts: 15
Joined: Mon Mar 31, 2014 10:29 pm

wrapper.php and the method to handle base64 encoded images

Post by Helga »

Hi,

if I activate "Extends the TCPDF::Image() method to handle base64 encoded images" in wrapper.php I´m able to export pdfs with all images (copy & paste) with pdf printer.

Aber wenn ich die Export-Funktion im Admin-Bereich (pdf) oder den Button "pdf" bei einem FAQ-Artikel nutzen will, bleibt´s bei "http://faq.meineseite.de/pdf.php?cat=1&id=8&artlang=de" stehen und nichts passiert weiter. Kommentiere ich die "Extends the TCPDF..." Zeilen in der wrapper.php wieder aus, bekomme ich Fehlermeldungen, weil ich in den Artikeln Bilder per copy und paste eingefügt habe. Was mach ich falsch?

Gruß
Helga
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: wrapper.php and the method to handle base64 encoded imag

Post by Thorsten »

Hi Helga,

die Image() Methode aus der Wrapper-Klasse sollte immer verwendet werden oder was meinst du?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Helga
Posts: 15
Joined: Mon Mar 31, 2014 10:29 pm

Re: wrapper.php and the method to handle base64 encoded imag

Post by Helga »

Hallo Thorsten,

da hab ich mich aber auch tatsächlich blöd ausgdedrückt. Sorry. :)

Also: Ich füge in FAQs Bilder (Screenshots, was auch immer) über Copy&Paste ein.

Wenn ich diese Artikel dann als PDF exportieren will, bekomme ich einen Fehler angezeigt:

"TCPDF ERROR: [Image] Unable to get image: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOwAAAEeCAYAAACJ/vmyAABAAElEQVR4Aey9B5hl11Xnu26%20laurU3VUB6mVW ...."

Irgendwo hab ich gelesen, dass helfen könnte, bei der wrapper.php jeweils /** und */ bei den Zeilen 463 bis 501 zu entfernen:

Code: Select all

   /**
     * Extends the TCPDF::Image() method to handle base64 encoded images
     *
     * @param string  $file      Name of the file containing the image or a '@' character followed by the image data
     *                           string. To link an image without embedding it on the document, set an asterisk character
     *                           before the URL (i.e.: '*http://www.example.com/image.jpg').
     * @param string  $x         Abscissa of the upper-left corner (LTR) or upper-right corner (RTL).
     * @param string  $y         Ordinate of the upper-left corner (LTR) or upper-right corner (RTL).
     * @param integer $w         Width of the image in the page. If not specified or equal to zero, it is automatically
     *                           calculated.
     * @param integer $h         Height of the image in the page. If not specified or equal to zero, it is automatically
     *                           calculated.
     * @param string  $type      Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library)
     *                           and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not
     *                           specified, the type is inferred from the file extension.
     * @param string  $link      URL or identifier returned by AddLink().
     * @param string  $align     Indicates the alignment of the pointer next to image insertion relative to image height.
     * @param boolean $resize    If true resize (reduce) the image to fit $w and $h (requires GD or ImageMagick library);
     *                           if false do not resize; if 2 force resize in all cases (upscaling and downscaling).
     * @param integer $dpi       dot-per-inch resolution used on resize
     * @param string  $palign    Allows to center or align the image on the current line.
     * @param boolean $ismask    true if this image is a mask, false otherwise
     * @param mixed   $imgmask   Image object returned by this function or false
     * @param integer $border    Indicates if borders must be drawn around the cell.
     * @param mixed   $fitbox    If not false scale image dimensions proportionally to fit within the ($w, $h) box.
     *                           $fitbox can be true or a 2 characters string indicating the image alignment inside the
     *                           box. The first character indicate the horizontal alignment (L = left, C = center,
     *                           R = right) the second character indicate the vertical algnment (T = top, M = middle,
     *                           B = bottom).
     * @param boolean $hidden    If true do not display the image.
     * @param boolean $fitonpage If true the image is resized to not exceed page dimensions.
     * @param boolean $alt       If true the image will be added as alternative and not directly printed (the ID of the
     *                           image will be returned).
     * @param array   $altimgs   Array of alternate images IDs. Each alternative image must be an array with two values:
     *                           an integer representing the image ID (the value returned by the Image method) and a
     *                           boolean value to indicate if the image is the default for printing.
     *
     * @return image information
     */
Ja, eine Fehlermeldung bekomme ich dann tatsächlich nicht mehr, weil der Export erst gar nicht mehr funktioniert. Mit Rechtsklick auf den entsprechenden "PDF-Version"-Button und "Ziel speichern unter", kann ich die pdf.php herunterladen - und nichts anderes. Gibt es eine andere Lösung oder hab ich irgendetwas übersehen?

Ich hoffe, ich hab mich jetzt verständlicher ausgedrückt? Ich habe leider keine Ahnung von php & co.

Gruß
Helga
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: wrapper.php and the method to handle base64 encoded imag

Post by Thorsten »

Hi,

der Code war mal der Versuch von mir, dass die Base64 kodierten Bilder im PDF funktionieren, leider klappt es nicht. Ich werde mir das aber mal wieder ansehen...

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Helga
Posts: 15
Joined: Mon Mar 31, 2014 10:29 pm

Re: wrapper.php and the method to handle base64 encoded imag

Post by Helga »

Hallo Thorsten,

ah, o.k., danke. Gibt es alternativ die Möglichkeit, den Ausdruck einer FAQ anzupassen (Design, Logo,...) ? Dann müssen die User eben einen PDF-Drucker nutzen.

Gruß
Helga
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: wrapper.php and the method to handle base64 encoded imag

Post by Thorsten »

Hi,

man müsste das in die Wrapper.php einbauen...

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Helga
Posts: 15
Joined: Mon Mar 31, 2014 10:29 pm

Re: wrapper.php and the method to handle base64 encoded imag

Post by Helga »

Hallo Thorsten,

danke. Ich wühl mich mal durch http://www.tcpdf.org/examples.php

Gruß
Helga
Post Reply