• Resolved ironfish2

    (@ironfish2)


    Hi, your instructions say:

    Generate a random word for CAPTCHA.

    $word = $captcha_instance->generate_random_word();

    Generate an image file and a corresponding text file in the temporary directory.

    $prefix = mt_rand();
    $captcha_instance->generate_image( $prefix, $word );

    Then, show the image and get an answer from respondent.

    But it doesnt tell how to show the image??

    I feel really stupid here but I dont know how to show the image. All i can think of is something like:

    echo $captcha_instance->generate_image( $prefix, $word );

    But that only generates eg 1582600045.png – the image file name.

    I still need to know the filepath, etc.

    I have tried reading thru the first 5 pages of your support section and dont see anything…

    Please help

    • This topic was modified 7 years, 6 months ago by ironfish2.
    • This topic was modified 7 years, 6 months ago by ironfish2.
    • This topic was modified 7 years, 6 months ago by ironfish2.
Viewing 1 replies (of 1 total)
  • Thread Starter ironfish2

    (@ironfish2)

    Ok, I figured it out.

    Not sure why you would not include the steps to display the image.

    For anyone else that may have the same issue:

    
    // Generate an image file and a corresponding text file in the temporary directory.
    $prefix = mt_rand();
    $captcha_image_name = $captcha_instance->generate_image( $prefix, $word );
    
    // Create the image file path:
    $captcha_image_file_path = plugins_url().'/really-simple-captcha/tmp/'.$captcha_image_name;
    
    // Debug:
    //echo $captcha_image_file_path;
    
    // Display the image:
    echo '<img src="'.$captcha_image_file_path.'">';
    
    • This reply was modified 7 years, 6 months ago by ironfish2.
    • This reply was modified 7 years, 6 months ago by ironfish2.
Viewing 1 replies (of 1 total)
  • The topic ‘How to show the image?’ is closed to new replies.