Programming Articles

Page 1021 of 2547

How to rotate an image with a given angle using imagerotate() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 1K+ Views

The imagerotate() function is an inbuilt PHP function used to rotate an image by a specified angle in degrees. This function is part of the GD extension and provides a simple way to perform image rotation operations. Note: This function requires the GD extension to be enabled. Install it using: sudo apt-get install php-gd (Ubuntu/Debian) or enable it in php.ini by uncommenting extension=gd. Syntax resource imagerotate($image, $angle, $bgd_color, $ignore_transparent = 0) Parameters The imagerotate() function accepts four parameters ? $image − An image resource created by functions like imagecreatetruecolor(), ...

Read More

How to get or set the resolution of an image using imageresolution() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 1K+ Views

The imageresolution() function is an inbuilt PHP function that is used to get or set the resolution of an image in dots per inch (DPI). If no optional parameters are given, it returns the current resolution as an indexed array. If optional parameters are provided, it sets both the width and height resolution. The resolution is only used as meta information when images are read from and written to formats that support this information (currently PNG and JPEG). It does not affect drawing operations. The default resolution for new images is 96 DPI. Syntax mixed imageresolution(resource ...

Read More

How to copy the palette from one image to another using imagepalettecopy() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 205 Views

The imagepalettecopy() function is an inbuilt PHP function used to copy the color palette from one image resource to another. This function is particularly useful when working with palette-based images where you want to share the same color scheme between multiple images. Syntax void imagepalettecopy(resource $destination, resource $source) Parameters The imagepalettecopy() function accepts two parameters ? $destination − Specifies the destination image resource that will receive the copied palette. $source − Specifies the source image resource from which the palette will be copied. Return Value This function does not ...

Read More

How can I write in order with for loop or while loop?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 322 Views

In C programming, we can create ordered patterns using for loops or while loops. This example demonstrates how to generate a specific numerical pattern where each line contains repeating digits based on the line number. Syntax for(initialization; condition; increment) { // loop body } while(condition) { // loop body increment; } Method 1: Using For Loop This approach uses nested for loops to create a pattern where each line displays the line number followed by repeating 0s and 1s − ...

Read More

How to draw an open polygon using the imageopenpolygon() function n PHP?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 456 Views

The imageopenpolygon() function is an inbuilt PHP function used to draw an open polygon on a given image. Unlike closed polygons, open polygons do not connect the last point back to the first point, creating an incomplete shape. Syntax bool imageopenpolygon(resource $image, array $points, int $num_points, int $color) Parameters The imageopenpolygon() function accepts four parameters: $image − Specifies the image resource to work on. $points − Specifies the points of the polygon as an array of x, y coordinates. $num_points − Specifies the ...

Read More

How do I set up C/C++ on Eclipse in Windows?

Arushi
Arushi
Updated on 15-Mar-2026 11K+ Views

Setting up C/C++ development environment on Eclipse in Windows requires installing a compiler and the Eclipse CDT plugin. This guide walks you through the complete setup process using MinGW GCC compiler. Prerequisites System Requirements: Windows 7 or later, Java 8 or higher installed on your system. Step 1: Install MinGW GCC Compiler Eclipse requires a C/C++ compiler to build and run programs. MinGW (Minimalist GNU for Windows) is recommended for its simplicity − Visit the MinGW official website at www.mingw.org Download the latest MinGW installation program (MinGW-.exe) Run the installer and select ...

Read More

How to draw a line using imageline() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 2K+ Views

The imageline() function is an inbuilt function in PHP that is used to draw a line between two given points on an image resource. Syntax bool imageline(resource $image, int $x1, int $y1, int $x2, int $y2, int $color) Parameters The imageline() function takes six parameters: $image − Specifies the image resource to work on. $x1 − Specifies the starting x-coordinate. $y1 − Specifies the starting y-coordinate. $x2 − Specifies the ending x-coordinate. $y2 − Specifies the ending ...

Read More

When to use C over C++, and C++ over C?

Akansha Kumari
Akansha Kumari
Updated on 15-Mar-2026 2K+ Views

Both C and C++ are powerful programming languages used by developers to write system-level and application programs. C follows a procedural programming paradigm with a simple and structured approach, while C++ supports both procedural and object-oriented programming. Although both languages are widely used across various fields, they have different strengths and use cases. This article explores when to choose C over C++ and vice versa. When to Use C Language? C is preferred in the following scenarios − System Programming: When writing low-level system software like operating systems, embedded systems, or ...

Read More

How to set the alpha blending flag to use layering effects using imaglayereffect() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 208 Views

The imagelayereffect() function is an inbuilt PHP function used to set alpha blending flags for layering effects on images. It controls how pixels are blended when drawing on an image, returning true on success or false on failure. Syntax bool imagelayereffect($image, $effect) Parameters The function accepts two parameters ? $image − An image resource created by image creation functions like imagecreatetruecolor(). $effect − The blending effect constant to apply. Available constants are ? IMG_EFFECT_REPLACE − Sets pixel replacement mode (similar to imagealphablending($image, true)) IMG_EFFECT_ALPHABLEND − Sets normal pixel blending (equivalent to ...

Read More

What is the difference Between C and C++?

Alankritha Ammu
Alankritha Ammu
Updated on 15-Mar-2026 1K+ Views

C and C++ are closely related programming languages, with C++ being developed as an extension of C. While they share many similarities, there are fundamental differences in their design philosophy and features. Key Differences Between C and C++ Aspect C C++ Programming Paradigm Procedural Programming Object-Oriented Programming Building Blocks Functions Objects and Classes Memory Management malloc() and free() new and delete operators Variable References Not supported Supported Function Overloading Not supported Supported Operator Overloading Not supported Supported Exception Handling Not supported try-catch ...

Read More
Showing 10201–10210 of 25,466 articles
Advertisements