Ankith Reddy has Published 996 Articles

Zoom HTML5 Canvas to Mouse Cursor

Ankith Reddy

Ankith Reddy

Updated on 24-Jan-2020 10:52:18

1K+ Views

The canvas always scales from its current origin. The default origin is [0, 0]. If you want to scale from another point, you can first do ctx.translate(desiredX, desiredY);. This will reset the origin of the canvas to [desiredX, desiredY].The translate() method remaps the (0, 0) position on the canvas. The ... Read More

AngularJS and HTML5 date input value - how to get Firefox to show a readable date value in a date input?

Ankith Reddy

Ankith Reddy

Updated on 24-Jan-2020 10:46:12

271 Views

The elements of type date allows user to enter date, using a text box or using date picker. With the ng-model directive, bins the values of AngularJS application data to HTML input controls. Firefox does not currently support type="date". It will convert all the values to string. Sinceyou want ... Read More

Is their a JavaScript Equivalent to PHP explode()?

Ankith Reddy

Ankith Reddy

Updated on 23-Jan-2020 07:05:08

2K+ Views

The JavaScript equivalent to PHP explode() is split(). To get the data after the first colon, try to run the following code.Example                    var str = '087000764008:Rank:info:result';          var arr = str.split(":");          document.write(arr[1] + ":" + arr[2]);          

imagecolormatch() function in PHP

Ankith Reddy

Ankith Reddy

Updated on 31-Dec-2019 07:59:35

79 Views

The imagecolormatch() function forms the colors of the palette version of an image more closely match the true color versionSyntaxbool imagecolormatch ( img1, img2 )Parametersimg1: Create image with imagecreatetruecolor() function.img2: A palette image link resource pointing to an image. This image has the same size as img1.ReturnThe imagecolormatch() function returns ... Read More

imagecolorset() function in PHP

Ankith Reddy

Ankith Reddy

Updated on 31-Dec-2019 07:46:41

118 Views

The imagecolorset() function sets the color for the specified palette index. Using this create flood-fill-like effects in palleted images.Syntaximagecolorset ( img, index, red, green, blue, alpha )Parametersimg: Image created with imagecreatetruecolor() functionindex: The index in the palette imagered: Value of red componentgreen: Value of green componentblue: Value of blue componentalpha: ... Read More

imagecharup() function in PHP

Ankith Reddy

Ankith Reddy

Updated on 31-Dec-2019 07:40:15

50 Views

The imagecharup() function is used to draw a character vertically.Syntaximagecharup( img, font, x, y, c, color )Parametersimg: Create an image with imagecreatetruecolor()font: Sets the font size. It can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encodingx: x-coordinatey: y-coordinatec: character to be drawncolor: color identifierReturnThe imagecharup() function ... Read More

imagecolorallocatealpha() function in PHP

Ankith Reddy

Ankith Reddy

Updated on 31-Dec-2019 07:22:02

255 Views

The imagecolorallocatealpha() function allocates a color for an image.Syntaximagecolorallocatealpha ( img, red, green, blue, alpha )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentalpha: The transparency of image, with 0 indicating completely opaque, whereas 127 indicating completely transparent.ReturnThe imagecolorallocatealpha() function returns a color identifier or FALSE ... Read More

imagecolorclosestalpha() function in PHP

Ankith Reddy

Ankith Reddy

Updated on 31-Dec-2019 07:19:16

74 Views

The imagecolorclosestalpha() function gets the index of closet color with alpha value.Syntaximagecolorclosestalpha ( img, red, green, blue, alpha )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentalpha: The transparency of image, with 0 indicating completely opaque, whereas 127 indicating completely transparent.ReturnThe imagecolorclosestalpha() function returns ... Read More

imagesx() function in PHP

Ankith Reddy

Ankith Reddy

Updated on 31-Dec-2019 06:24:40

286 Views

The imagesx() function gets the width of image. It returns the width of the image or FALSE on errors.Syntaximagesx(img)Parametersimg: Image resource created with imagecreatetruecolor()ReturnThe imagesx() function returns the width of the image or FALSE on errors.ExampleThe following is an example: Live DemoOutputThe following is the output:450Read More

imagefill() function in PHP

Ankith Reddy

Ankith Reddy

Updated on 31-Dec-2019 06:21:35

393 Views

The imagefill() function is used to fill the image.Syntaximagefill(img, x, y, color)ParametersimgCreate a blank image with imagecreatetruecolor().x x-coordinate of start pointy y-coordinate of start pointcolor The fill color.ReturnThe imagefill() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:Read More

Advertisements