captcha_width

Sets the width of the captcha image in pixels.

Syntaxcaptcha_width pixels;
Default130
Contexthttp, server, location
Arguments1

Description

The captcha_width directive is part of the NGINX Captcha Module, which facilitates the generation of captcha images for form submissions. This directive specifically configures the width of the captcha image that is rendered to the user. The width setting directly influences the dimensions of the generated image, ensuring that it fits adequately within the layout of a webpage or application. Providing a suitable width helps maintain the balance between aesthetic design and functional requirements.

The value specified for captcha_width should be a positive integer that denotes the number of pixels. It is essential to ensure that the width aligns with other dimensions defined for the captcha, such as height, to maintain a proper visual proportion. Adjusting the width can affect the overall usability of the captcha; for instance, a width that is too small may result in text that is difficult to read, while a width that is excessively large may unnecessarily consume space in the UI.

This directive can be employed in various contexts, such as http, server, or location, allowing for flexibility depending on the specific requirement or scope of your configuration. By default, the directive is set to a width of 130 pixels, which can be modified to suit specific layout needs or design specifications.

Config Example

location =/captcha {
    captcha;
    captcha_width 200;
}

Ensure the value is a positive integer to avoid configuration errors.

Setting an excessively large width may negatively impact the overall layout of the page.

The width should be considered in conjunction with the height to maintain proper aspect ratio.

← Back to all directives