- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to draw a string vertically using imagestringup() function in PHP?
imagestringup() is an inbuilt function in PHP that is used to draw an image vertically.
Syntax
bool imagestringup ($image, $font, $x, $y, $string, $color)
Parameters
imagestring() accepts six parameters: $image, $font, $x, $y, $string, and $color.
$image − The $image parameter uses imagecreatetruecolor() function to create a blank image of given size.
$font − The $font parameter is used to set the font-size values from 1, 2, 3, 4, and 5 for inbuilt fonts or other font identifiers registered with imageloadfont() function.
$x − Holds the position of the font in the horizontal X-axis, upper leftmost corner.
$y − Holds the position of the font in the vertical Y-axis, topmost corner.
$string − The $string parameter holds the string to be written.
$color − This parameter holds the color of the image.
Return Values
imagestring() returns True on success and False on failure.
Example
<?php // Create a 250*190 image using imagecreatetruecolor() function $img = imagecreatetruecolor(700, 300); // Set the background color of the image $bgcolor = imagecolorallocate($img, 122, 122, 122); // Fill background with above-selected color imagefill($img, 0, 0, $bgcolor); // Write the white color text $textcolor = imagecolorallocate($img, 255, 255, 255); imagestringup($img, 6, 130, 150, 'Hello World', $textcolor); // Output the picture to the browser header('Content-type: image/png'); imagepng($img); ?>