We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29181
    • 480 Posts
    Hi,

    I’m trying to add vericode to my eForm that uses version 1.4.4. but it isn’t displaying an image. I am getting a "not available image" which points to http://site.com/manager/includes/veriword.php?rand=2003364844 This problem is not really eForm specific, but hopefully in the correct place anyways.

    Now if I target that address directly I get an fatal error which is probably the cause of the problem:
    Fatal error: Call to undefined function imagettfbbox() in /site/manager/includes/veriword.php on line 126

    Line 126 looks like:
    $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word);

    Initially I thought that GD image wasn’t installed but according to phpinfo.php (and the provider) it is, using version "bundled (2.0.28 compatible)".

    I’m using a 0.9.6 MODx & PHP 5.1.2 and would be grateful for any solution anyone can offer!
    [EDIT]
    After some more hunting it would appear that FreeType Support hasn’t been enabled. For anyone else as clueless as me when it comes to this sort of thing you can create a snippet with
    <?php
    var_dump(gd_info());
    ?>
    


    which will return an array showing what exactly has been turned on and what not.
    [/EDIT]
    Taff
      Adrian Lawley: www.adrianlawley.com
      • 31186
      • 20 Posts
      Here is the output regarding GD etc:

      array(12) { ["GD Version"]=> string(13) "2.0 or higher" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["T1Lib Support"]=> bool(true) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(false) ["XBM Support"]=> bool(false) ["JIS-mapped Japanese Font Support"]=> bool(false) }

      So, it looks like its on and ready, but images are still not showing up for me. Any ideas ?
        • 30223
        • 1,010 Posts
        Without more info about your form and eform calls no, no idea. I’m guessing you’re missing the

         <img src="[+verimageurl+]" />


        in your template?
          • 31186
          • 20 Posts
          Page:

          [!eForm? &formid=`ContactForm` &subject=`[+subject+]` &to=`[(email_sender)]` &ccsender=`1` &tpl=`ContactForm` &report=`ContactFormReport` &invalidClass=`invalidValue` &requiredClass=`requiredValue` &cssStyle=`ContactStyles` &gotoid=`46` &vericode=`1`!]
          


          Form

          <p><span style="color:#900;">[+validationmessage+]</span></p>
          <form method="post" action="[~[*id*]~]">
          	<input type="hidden" name="formid" value="feedbackForm" />	
          
          	<p><label accesskey="c">Comments</label><br />
          	<textarea cols="40" rows="10" name="message" eform="Comments:html:1"></textarea></p>
          
          	<p>
          	Please enter the verification code below: (to prevent spam)<br />
          	<br />
          <img src="[+verimageurl+]" />
          	<input type="text" name="vericode" size="20" />
          	</p>
          	
          	<p><input type="submit" name="submit" value="Send Feedback"></p>
          </form>
          



          Actual output

          Please enter the verification code below: (to prevent spam)<br />
          	<br />
          <img src="/manager/includes/veriword.php?rand=1850393639" />
          	<input type="text" name="vericode" size="20" />
          
            • 30223
            • 1,010 Posts
            The form part is ok it seems. So what happens if you type in the /manager/includes/veriword.php?rand=1850393639 address directly into your browser?
              • 3749
              • 24,544 Posts
              I spent a lot of time futzing with the veriword function while working on the SPForm snippet. It’s very cranky and hard to troubleshoot. If you put any code in the veriword file to help you debug (echo or print statements) it won’t work because the image has to be the only output.

              If the GD functions are on, the most likely culprit is the path to the veriword file, especially if you get output using TobyL’s suggestion. Another test is to turn on CAPTCHA for the manager login and see if you get an image that way (although, if you don’t, you may have to turn it back off in the database using PhpMyAdmin in order to log in).

              I ended up moving the veriword file to the snippet directory and using something like this:

              $verifyUrl=$modx->config[’site_url’].$spformPath.’spfveriword.php’;

              Remember, too, that you have to clear the site cache and your browser cache each time you make a change or you may not see the results of your change.

              Bob
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 31186
                • 20 Posts
                1. There is no output if I visit that image url directly. Just an empty page (no source code either).

                2. If I enable captcha in the site’s general configuration settings, it does not appear on the manager login page, which makes me suspect GD related issues.

                3. None of the modx code has been modified, including any debugging stuff.

                4. This issue occurs on multiple installs of modx.


                Here is my GD as displayed on phpinfo:

                GD Support 	enabled
                GD Version 	2.0 or higher
                FreeType Support 	enabled
                FreeType Linkage 	with freetype
                FreeType Version 	2.2.1
                T1Lib Support 	enabled
                GIF Read Support 	enabled
                GIF Create Support 	enabled
                JPG Support 	enabled
                PNG Support 	enabled
                WBMP Support 	enabled
                
                  • 3749
                  • 24,544 Posts
                  It sure sounds like a problem with the hosting service’s GD setup.

                  Bob
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting