Arjun Thakur

Arjun Thakur

749 Articles Published

Articles by Arjun Thakur

Page 27 of 75

imagecolorresolvealpha() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 88 Views

The imagecolorresolvealpha() function in PHP gets the index of a specified color with alpha transparency in an image's palette. If the color doesn't exist, it allocates a new color index or returns the closest match. Syntax imagecolorresolvealpha(resource $image, int $red, int $green, int $blue, int $alpha) Parameters image − An image resource created by functions like imagecreatetruecolor() or imagecreatefromgif() red − Red component value (0-255) green − Green component value (0-255) blue − Blue component value (0-255) alpha − Alpha transparency value (0-127), where 0 is completely opaque and 127 is completely transparent ...

Read More

imagearc() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 425 Views

The imagearc() function in PHP is used to draw arcs and circles on images. It's part of the GD library and allows you to create curved lines with specified angles and dimensions. Syntax imagearc($img, $cx, $cy, $width, $height, $start, $end, $color) Parameters $img − Image resource created with imagecreatetruecolor() or similar functions. $cx − x-coordinate of the arc's center. $cy − y-coordinate of the arc's center. $width − Width of the ellipse containing the arc. $height − Height of the ellipse containing the arc. $start − Starting angle in degrees (0° is at ...

Read More

imagecolorexact() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 120 Views

The imagecolorexact() function in PHP retrieves the index of a specified color from an image's color palette. This function is useful when working with palette-based images where you need to find the exact index of a specific RGB color combination. Syntax imagecolorexact($img, $red, $green, $blue) Parameters img − Image resource created with functions like imagecreatefrompng() or imagecreatefromjpeg() red − Red color component (0-255) green − Green color component (0-255) blue − Blue color component (0-255) Return Value Returns the color index of the specified RGB color in the image palette, ...

Read More

imagepolygon() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 428 Views

The imagepolygon() function is used to draw a polygon on an image resource in PHP. This function is part of the GD library extension and allows you to create polygons with any number of vertices. Syntax bool imagepolygon(resource $image, array $points, int $num_points, int $color) Parameters $image − An image resource created with imagecreatetruecolor() or similar functions. $points − An array containing the x and y coordinates of the polygon's vertices in sequential order. $num_points − The total number of vertices (points) in the polygon. $color − A color identifier created with imagecolorallocate() ...

Read More

imagecolorat() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 384 Views

The imagecolorat() function gets the color index of a pixel at specific coordinates in an image resource. It's useful for analyzing pixel colors in image processing tasks. Syntax imagecolorat($image, $x, $y) Parameters $image − An image resource created by functions like imagecreate() or imagecreatefromjpeg() $x − The x-coordinate of the pixel (horizontal position) $y − The y-coordinate of the pixel (vertical position) Return Value Returns the color index as an integer, or FALSE on failure. For truecolor images, this returns the RGB value as a packed integer. Example 1: ...

Read More

imagefilledrectangle() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 1K+ Views

The imagefilledrectangle() function in PHP draws a filled rectangle on an image resource. This function is part of the GD extension and is commonly used for creating graphics, overlays, and visual elements programmatically. Syntax imagefilledrectangle($image, $x1, $y1, $x2, $y2, $color) Parameters $image − An image resource created by functions like imagecreatetruecolor(). $x1 − x-coordinate of the first corner (top-left). $y1 − y-coordinate of the first corner (top-left). $x2 − x-coordinate of the opposite corner (bottom-right). $y2 − y-coordinate of the opposite corner (bottom-right). $color − The fill color created with imagecolorallocate(). ...

Read More

uniqid() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 398 Views

The uniqid() function generates a unique ID based on the current time in microseconds. It's commonly used for creating temporary filenames, session IDs, or unique identifiers where collision probability needs to be minimized. Syntax uniqid(prefix, more_entropy) Parameters prefix − Optional string to prefix the unique ID. Default is empty string. more_entropy − Optional boolean. If TRUE, adds additional entropy at the end for better uniqueness. Default is FALSE. Return Value The uniqid() function returns a unique identifier as a string, typically 13 characters long (23 characters when more_entropy is TRUE). ...

Read More

show_source() function in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 288 Views

The show_source() function in PHP displays the source code of a PHP file with syntax highlighting. This function is useful for code documentation, debugging, or educational purposes where you need to display formatted PHP source code. Syntax show_source(file, return) Parameters file − The file name to display. This can be a relative or absolute path to the PHP file. return − Optional boolean parameter. If set to true, the function returns the highlighted code as a string instead of printing it. Default is false. Return Value If the return parameter ...

Read More

FILTER_SANITIZE_STRING constant in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 484 Views

The FILTER_SANITIZE_STRING constant removes HTML tags and encodes special characters from a string. This filter is useful for cleaning user input to prevent XSS attacks. Note: As of PHP 8.1.0, FILTER_SANITIZE_STRING is deprecated. Use htmlspecialchars() or custom validation instead. Syntax filter_var($value, FILTER_SANITIZE_STRING, $flags) Flags FILTER_FLAG_NO_ENCODE_QUOTES − Do not encode quotes FILTER_FLAG_STRIP_LOW − Removes characters with ASCII value less than 32 FILTER_FLAG_STRIP_HIGH − Removes characters with ASCII value greater than 127 FILTER_FLAG_ENCODE_LOW − Encodes characters with ASCII value less than 32 FILTER_FLAG_ENCODE_HIGH − Encodes characters with ASCII value greater than 127 FILTER_FLAG_ENCODE_AMP − ...

Read More

FILTER_SANITIZE_EMAIL constant in PHP

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 491 Views

The FILTER_SANITIZE_EMAIL constant removes all characters from a string that are not allowed in an email address according to RFC standards. This filter is useful for cleaning user input before validation or storage. Syntax filter_var($email, FILTER_SANITIZE_EMAIL) Parameters The filter_var() function accepts the following parameters when used with FILTER_SANITIZE_EMAIL − $email − The email string to be sanitized FILTER_SANITIZE_EMAIL − The filter constant that removes illegal email characters Return Value Returns the sanitized email string with illegal characters removed, or FALSE on failure. Example The following example demonstrates ...

Read More
Showing 261–270 of 749 articles
« Prev 1 25 26 27 28 29 75 Next »
Advertisements