whiteboikyle Posted June 3, 2008 Share Posted June 3, 2008 I have an image that auto add's info to.. Before it add's info the image is fine.. but after using PHP it gets really pixelted Captcah.php <?php require("config.php"); $name = $_GET['name']; if($name == "") { die(); } else { // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $query = "SELECT * FROM btcs3_members where username = '".$name."'"; $result = mysql_query($query); for ($i = 0; $i < mysql_num_rows($result); $i = $i + 1) { $aim = mysql_result($result, $i, "aim"); $rank = mysql_result($result, $i, "rank"); $user = mysql_result($result, $i, "username"); $maingame = mysql_result($result, $i, "maingame"); $inactive = mysql_result($result, $i, "inactive"); $disable = mysql_result($result, $i, "disable"); $medals = mysql_result($result, $i, "medals"); $datejoined = mysql_result($result, $i, "datejoined"); $recruits = mysql_result($result, $i, "recruits"); } //Days In Clan $days = round((time() - $datejoined)/86400); if($disable == "1") { $active = "DISABLED"; } else { if($inactive = "0"){ $active = "IA"; } else { $active = "Active"; } } $medals = count($medals); if($rank == "31") { $rank = "Commander"; } if($maingame == "5") { $maingame = "Counter-Strike 1.6"; } session_start(); $im = imagecreatefrompng ("image/image.png"); $color = imagecolorallocate($im, 1, 1, 1); $text = "Name: "; $font = 'arial.ttf'; $size = 10; //Active imagettftext($im, $size, 0, 420, 89, $color, $font, $active); //Medals imagettftext($im, $size, 0, 425, 31, $color, $font, $medals); //MainGame imagettftext($im, $size, 0, 258, 89, $color, $font, $maingame); //rank imagettftext($im, $size, 0, 228, 60, $color, $font, $rank); //Days In Clan imagettftext($im, $size, 0, 455, 60, $color, $font, $days); //Name imagettftext($im, $size, 0, 228, 31, $color, $font, $user); //aim imagettftext($im, $size, 0, 215, 118, $color, $font, $aim); //Recruits imagettftext($im, $size, 0, 431, 118, $color, $font, $recruits); header('Content-type: image/png'); imagejpeg($im); imagedestroy($im); } ?> Config <?php $host="BLOCKED FOR SECURE"; // Host name $username="BLOCKED FOR SECURE"; // Mysql username $password="BLOCKED FOR SECURE"; // Mysql password $db_name="BLOCKED FOR SECURE"; // Database name ?> Here is the LocalHost Output Here is the Hosting Output: ]http://scripts.corpaluploads.com/gd/captcha.php?name=Yakuza[Ki] Link to comment https://forums.phpfreaks.com/topic/108463-solved-captcha-image-pixelated/ Share on other sites More sharing options...
Caesar Posted June 3, 2008 Share Posted June 3, 2008 <?php imagejpeg($image, $temp_directory, $quality); ?> Basically, you can define the image quality %. Link to comment https://forums.phpfreaks.com/topic/108463-solved-captcha-image-pixelated/#findComment-556133 Share on other sites More sharing options...
DarkerAngel Posted June 3, 2008 Share Posted June 3, 2008 Follow his suggestion or output it as PNG using imagepng() rather than imagejpeg() (which I don't understand why your calling the header as image/png and outputting it as JPEG anyways) Link to comment https://forums.phpfreaks.com/topic/108463-solved-captcha-image-pixelated/#findComment-556138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.