Jump to content

gd help cheers


redarrow

Recommended Posts

how can i change the font size of the text and the

picture size read the manual so hard gd please help.

 

<?php
header("Content-type: image/jpeg");
$text=rand(000000,111111);
$string = $text;
$im    = imagecreatefromjpeg("grey.jpg");
$blue = imagecolorallocate($im, 0, 0, 255);
$px    = (imagesx($im) - 5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $blue);
imagejpeg($im);
imagedestroy($im);
?> 

Link to comment
https://forums.phpfreaks.com/topic/41769-gd-help-cheers/
Share on other sites

 

 

All i need to no now is how to get the image size reduced but how getting there.

<?php
//header for jpeg image.
header("Content-type: image/jpeg");

//6 figure random number
$text=rand(000000,111111);
// varable string to text to get number on image.
$string = $text;

//get image but jpeg and location.
$im    = imagecreatefromjpeg("grey.jpg");

//set color for image
$blue = imagecolorallocate($im, 0, 0, 255);

//postion the number and show the number
$px    = (imagesx($im) - 5 * strlen($string)) / 2;

// put it all together and postion the final number.
imagestring($im, 3, $px, 9, $string, $blue);

// make sure it a image jpeg.
imagejpeg($im);

//destroy the image.
imagedestroy($im);
?> 

Link to comment
https://forums.phpfreaks.com/topic/41769-gd-help-cheers/#findComment-202547
Share on other sites

how to add this to the img size

$im = imagecreatetruecolor(70, 30);

 

to this tried and faild

<?php
header("Content-type: image/jpeg");
$text=rand(000000,111111);
$string = $text;
$im = imagecreatefromjpeg("grey.jpg");
$blue = imagecolorallocate($im, 0, 0, 255);
$px    = (imagesx($im) - 10 * strlen($string)) / 2; 
imagestring($im, 20, $px, 50, $string, $blue);
imagejpeg($im);
imagedestroy($im);
?> 

Link to comment
https://forums.phpfreaks.com/topic/41769-gd-help-cheers/#findComment-202585
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.