Jump to content

I dont want to use imagecreatefromjpeg("img.jpg");


Gayner

Recommended Posts

i want to use a div tag instead? like this:

 

http://forums.d2jsp.org/register.php?a=1&i=5e51794914805f1eaf481fcbafdc29f1

 

if u got here there's no background image, just a css tag applied with a nice blue background borders.

 

I have that css tag, but this is my code to try to make it a css tag instead of background image.

 

 

 

session_start();

$RandomStr = md5(microtime());// md5 to generate the random string

$ResultStr = substr($RandomStr,0,5);//trim 5 digit 

$NewImage = imagecreatefromjpeg("img.jpg");//image create by existing image and as back ground 

$LineColor = imagecolorallocate($NewImage,553,539,239);//line color 
$LineColor = imagecolorallocate($NewImage,223,539,239);//line color 
$TextColor = imagecolorallocate($NewImage, 255, 255, 255);//text color-white

imageline($NewImage,1,1,40,40,$LineColor);//create line 1 on image 
imageline($NewImage,1,100,60,0,$LineColor);//create line 2 on image 
imageline($NewImage,1,500,20,0,$LineColor2);//create line 3 on image 
imagestring($NewImage, 5, 20, 10, $ResultStr, $TextColor);// Draw a random string horizontally 

$_SESSION['key'] = $ResultStr;// carry the data through session

header("Content-type: image/jpeg");// out out the image 

imagejpeg($NewImage);//Output image to browser 

 

thx

I'm not really sure what you're asking, can you try to explain your question better please?

 

Like on that http://forums.d2jsp.org/register.php?a=1&i=8b0135f3acf84ef965d5d0cc5a0ea9b7

 

it doesnt have a background image?

 

I just want my script to shoot out the text. not without a background image, lol.  I want to apply a div tag behind the captcha instead of a image.

His background image probably includes the border, and each character is probably drawn separate rather than in a single string.

 

i found 1

 

$text = rand(10000,99999); 
$_SESSION["vercode"] = $text; 
$height = 25; 
$width = 65; 

$image_p = imagecreate($width, $height); 
$black = imagecolorallocate($image_p, 0, 0, 0); 
$white = imagecolorallocate($image_p, 255, 255, 255); 
$font_size = 14; 

imagestring($image_p, $font_size, 5, 5, $text, $white); 
imagejpeg($image_p, null, 80); 

 

works :D

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.