PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Captcha image broken link when using Amazon s3 as uploads directory.

  1. http://www.productionlocations.com/contact/list-your-property/

    Because I'm redirecting uploads to an Amazon s3 bucket, the captcha image is broken because there is no captcha image directory in my s3 bucket.

    I need a way of setting the uploads directory that gravity forms uses specifically to my wordpress server's uploads folder.

    I had the same issue using contact form 7 and was easily able to remedy the problem using the following in WP-config.php

    define( 'WPCF7_CAPTCHA_TMP_URL', WP_HOME . '/wp-content/uploads/wpcf7_captcha' );

    Is there a similar method of defining that temporary captcha directory for gravity forms?

    THANKS!

    Posted 12 years ago on Friday May 11, 2012 | Permalink
  2. David Peralty

    I am not entirely understanding what is happening here. Which captcha service are you using?

    Here is where you can change upload path information:
    http://www.gravityhelp.com/documentation/page/Gform_upload_path

    Posted 12 years ago on Friday May 11, 2012 | Permalink
  3. I'm using really simple captcha.

    The issue is that the captcha image currently uses the following address:

    http://img.productionlocations.com/wp-content/uploads/gravity_forms/captcha-df4724a16aa5637e2129f98c2b9f674d/2085126867.png

    that link above points to my amazon s3 bucket.

    I need it to use WWW. instead of IMG. productionlocations.com

    I put the following in my functions.php but it doesn't seem to be working.
    http://pastebin.com/QbKj1nTd
    thanks for the quick response! I appreciate it.

    Posted 12 years ago on Friday May 11, 2012 | Permalink
  4. David Peralty

    How are you including RSC in the Gravity Forms form you have? The issue that I see is that Gravity Forms didn't determine where to store that issue, as it really isn't uploaded/controlled by our plugin. While it was made for Contact Form 7 and has a hook that allows you to control RSC.

    You'll want to contact the developer and see what call you need in your wp-config to force the www vs img.

    Posted 12 years ago on Monday May 14, 2012 | Permalink
  5. David... Gravity forms *does* determine where to store the image... im gravityforms/common.php, function:

    on line 3424public static function get_captcha($field){

    then on 3468 through 3470:

    $filename = $captcha->generate_image($prefix, $word);
            $url = RGFormsModel::get_upload_url("captcha") . "/" . $filename;
            $path = $captcha->tmp_dir . $filename;

    There should be some way of specifying this upload directory in $url without altering the plugin.

    I hacked this together and it works but is going to cause problems when I have to update...

    $uploadpath = RGFormsModel::get_upload_url("captcha");
            $uploadpath = explode('gravity_forms/', $uploadpath);
            $url = 'http://productionlocations.com/wp-content/uploads/gravity_forms/'.$uploadpath[1].'/'.$filename;
    Posted 12 years ago on Monday May 14, 2012 | Permalink
  6. David Peralty

    Sorry, I should have been more specific. We don't really control which subdomain the images are sent to. You wanted to change it from img to www. I will pass this on to the developers to have a look on what we can do that will survive upgrades.

    Posted 12 years ago on Monday May 14, 2012 | Permalink