captcha_height

Sets the height of the CAPTCHA image in pixels.

Syntaxcaptcha_height pixels;
Default30
Contexthttp, server, location
Arguments1

Description

The 'captcha_height' directive sets the height of the CAPTCHA image generated by the NGINX Captcha Module. This directive allows users to configure the vertical dimension of the CAPTCHA image to accommodate different design requirements or user interface elements. The height value, specified in pixels, should be set according to the overall aesthetic and functional needs of the application implementing the CAPTCHA system. By default, if not specified, the height is set to 30 pixels, which is commonly sufficient for displaying CAPTCHA text clearly.

When configuring this directive, it can be placed within an 'http', 'server', or 'location' context, allowing flexible adjustment depending on the desired scope of application. The directive accepts a single integer argument that represents the pixel height for the CAPTCHA image. For web applications that feature diverse themes or user flows, having the ability to adjust the height can enhance legibility and ensure better integration with the existing layout. For example, if a larger font size is chosen for the CAPTCHA text, increasing the height through this directive would likely be necessary to maintain a good visual ratio.

It is important to note that setting the height too low may result in overlapping text or a CAPTCHA that is difficult for users to read. Therefore, it is advisable to test different height values to find the optimal size that balances aesthetic quality with user accessibility. Adjustments to this setting can also be complemented by other parameters such as 'captcha_width' and 'captcha_size' to completely redefine the CAPTCHA size.

Config Example

location =/captcha {
    captcha;
    captcha_height 40;
}

location =/login {
    # Other configurations
}

Setting captcha_height to a value that is too small may make the CAPTCHA unreadable.

Ensure that the height value is consistent with other dimensions like width to maintain a good aspect ratio.

← Back to all directives