image validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,i need image validation 4 form submit,
but,image is not creating,it give no image

code
<?php
header("Content-type: image/png");
$im = @imagecreatetruecolor(110, 20)
    or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
//----------------------------------------------------------------------------------------
or this

<?php
    session_start();        
    $md5_hash = md5(rand(0,9999)); 
    $security_code = substr($md5_hash, 25, 5); 
    $enc=md5($security_code);
    $_SESSION['count'] = $enc;
    $secure = $_SESSION['count'];
    //     echo "--------------------------$secure<br>";

    $width = 100;
    $height = 40; 
    
    $image = ImageCreate($width, $height);  
    $white = ImageColorAllocate($image, 255, 255, 255);
    $black = ImageColorAllocate($image, 0, 100, 0);
    $grey = ImageColorAllocate($image, 204, 204, 204);
     
    ImageFill($image, 0, 0, $grey); 
    //Add randomly generated string in white to the image
    ImageString($image, 10, 30, 10, $security_code, $black); 
    ImageRectangle($image,0,16,$width-1,$height-1,$grey); 
    imageline($image, 0, $height/2, $width, $height/2, $grey); 
    imageline($image, $width/2, 0, $width/2, $height, $grey); 
    
    header("Content-Type: image/jpeg"); 
    ImageJpeg($image);
    ImageDestroy($image);
    ImageDestroy($image);
    ?>




      Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux