• Default avatar
    wolfgang2    
     2 years ago
    0

    Hello,

    I started with AwoCoupon few days ago and now I'm trying to create a PDF coupon with the profile image inside.
    But when I use the TAG {image_embed} in the PDF Text I always get an error like this in the shop:

    TCPDF ERROR: [Image] Unable to get image: /www/u26/cms1/home/www/u26/cms1/tmp/1411390135994447433.jpg

    I suppose the generated path is wrong and the correct path shoud be only the last part of the string (/www/u26/cms1/tmp/1411390135994447433.jpg).
    Is there a solution for this problem?

    Thank you and best regards!
    Thomas
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    Yes, seems like it is adding extra at the beginning. If you embed the image, without putting it in a pdf, does it work?
  • Default avatar
    wolfgang2    
     2 years ago
    0

    Hello,

    yes, embedding the image directly into the E-Mail works without problem...

    Thomas
  • Your avatar
    seyi    
     2 years ago
    0

    Hello,

    Ok, then it must be something within TCPDF.

    Found this post:
    http://stackoverflow.com/questions/9415057/tcpdf-cant-image-because-it-is-using-a-wrong-directory-path

    Can you try the last suggestion there?

    In
    www/administrator/components/com_awocoupon/helpers/tcpdf/config/tcpdf_config.php, around line 63 is this
    <?php
    //define ('K_PATH_IMAGES', '');
    ?>


    Uncomment it, so it looks like this
    <?php
    define 
    ('K_PATH_IMAGES''');
    ?>


    Then try it again.
  • Default avatar
    wolfgang2    
     2 years ago
    0

    Hello Seyi,

    that didn't work, but I found a way which works in my case...

    In tcpdf.php about line 18564 comment/delete the following lines

    <?php
                            
    // replace relative path with real server path
                            
    if (($tag['attribute']['src'][0] == '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
                                
    $findroot strpos($tag['attribute']['src'], $_SERVER['DOCUMENT_ROOT']);
                                if ((
    $findroot === false) OR ($findroot 1)) {
                                    if (
    substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') {
                                        
    $tag['attribute']['src'] = substr($_SERVER['DOCUMENT_ROOT'], 0, -1).$tag['attribute']['src'];
                                    } else {
                                        
    $tag['attribute']['src'] = $_SERVER['DOCUMENT_ROOT'].$tag['attribute']['src'];
                                    }
                                }
                            }
    ?>


    BTW: in my Joomla/VirtueMart/AwoCoupon installation TCPDF is normally loaded from \libraries\tcpdf... So I had to do the comment in this tcpdf.php (in this file from line 24044 to 24053).

    Best regards,
    Thomas
  • Your avatar
    seyi    
     2 years ago
    0

    Thanks for getting back with the fix. The absolute path is always passed in, so commenting out that code is not a problem. Will get that updated for the next version also.

    And yes, did try to use tcpdf in libraries. But had many issues across the different versions in the different platforms.