altemur Posted March 9, 2007 Share Posted March 9, 2007 I have created colourfull images of characters of letters. by using a form i want to create words. the words will be a image. For exemple "word" is 4 letter. İnstead of 4 diffeen picture. Only one picture. i have tried with createimagefromgif function php but i couldnt. How we can do that? Thank for advance Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/ Share on other sites More sharing options...
Glyde Posted March 9, 2007 Share Posted March 9, 2007 Make sure PHP is compiled with GD support. Just search google for articles containing how you would enable GD support on a PHP based server. Then, you'd need to look into imagecreatefrompng or such other functions. Also, you'll need to read up on imagettftext or imagestring, as well was imagepng/imagejpeg/imagegif...etc. Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203211 Share on other sites More sharing options...
willpower Posted March 9, 2007 Share Posted March 9, 2007 Yes...These imagae functions WILL work. Juct check that you have the DG lib installed first. After that it is a case of opeining an image(or creating a blank one)...adding to it....returning the finishhed result. Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203346 Share on other sites More sharing options...
Gruzin Posted March 9, 2007 Share Posted March 9, 2007 http://www.phpfreaks.com/tutorials/105/0.php Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203353 Share on other sites More sharing options...
altemur Posted March 9, 2007 Author Share Posted March 9, 2007 i have done somting at last. i get the result. but there is black spaces between the characters. here the picture. How i will make it white Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203357 Share on other sites More sharing options...
willpower Posted March 9, 2007 Share Posted March 9, 2007 we'd need to see your code to understand where it comes from before we could remove it! Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203362 Share on other sites More sharing options...
altemur Posted March 9, 2007 Author Share Posted March 9, 2007 $len = strlen(strval($count)); if($len > $min_width) $width = $len; else $width = $min_width; if(!file_exists("$digit_dir/0.jpg")){ die("No images in digit-dir"); } $d0 = ImageCreateFromjpeg("$digit_dir/0.jpg"); $dx = ImageSX($d0); $dy = ImageSY($d0); $img = ImageCreateTrueColor($width*$dx, $dy); ImageDestroy($d0); $xoff = $width*$dx; while($xoff > 0) { $digit = $count % 10; $count = $count / 10; $temp = ImageCreateFromjpeg("$digit_dir/$digit.jpg"); $xoff = $xoff - $dx; ImageCopyResized($img, $temp, $xoff, 0, 0, 0, $dx, $dy, $dx, $dy); ImageDestroy($temp); } Header("Content-type: image/jpg"); Imagejpeg($img); ImageDestroy($img); Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203367 Share on other sites More sharing options...
altemur Posted March 9, 2007 Author Share Posted March 9, 2007 Sorry i for get to put all codes. Here all the page <?php /******************************************************** Variables *********************************************************/ $digit_dir = "./digits"; $file = "counter.txt"; $min_width = 5; $lifetime = 30; $domain = "www.offsite.be"; $use_mail = 1; $trigger = 1000; $your_email = "admin@offsite.be"; /******************************************************** Code --> DO NOT EDIT BELOW THIS POINT *********************************************************/ $fp = fopen($file, "r") or die("Failed to open counter-file"); $size = filesize($file); $count = fread($fp, $size); fclose($fp); if(!Isset($_COOKIE['counter'])){ $fp = fopen($file, "w"); $count++; fwrite($fp, $count); fclose($fp); setcookie("counter","dummy",time()+60*60*24*$lifetime,$domain); if($use_mail AND ($count%$trigger==0)){ $headers = "From: Counter <noreply@$domain>\n"; $headers .= "X-Sender: <noreply@$domain>\n"; $headers .= "X-Mailer: Offsite Counterscript\n"; $headers .= "Return-Path: <noreply@$domain>\n"; $subject = "Counter information from $domain"; $message = "Congratulations!\n\nThe number of visitors on your site has reached $count."; mail($email,$subject,$message,$headers); } } $len = strlen(strval($count)); if($len > $min_width) $width = $len; else $width = $min_width; if(!file_exists("$digit_dir/0.jpg")){ die("No images in digit-dir"); } $d0 = ImageCreateFromjpeg("$digit_dir/0.jpg"); $dx = ImageSX($d0); $dy = ImageSY($d0); $img = ImageCreate($width*$dx, $dy); ImageDestroy($d0); $xoff = $width*$dx; while($xoff > 0) { $digit = $count % 10; $count = $count / 10; $temp = ImageCreateFromjpeg("$digit_dir/$digit.jpg"); $xoff = $xoff - $dx; ImageCopyResized($img, $temp, $xoff, 0, 0, 0, $dx, $dy, $dx, $dy); ImageDestroy($temp); } Header("Content-type: image/jpg"); Imagejpeg($img); ImageDestroy($img); ?> Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203373 Share on other sites More sharing options...
willpower Posted March 9, 2007 Share Posted March 9, 2007 is there an actual image0.jpg...whats in it? I cant se where you set the background colour. havent time to test...but those are the 2 things i'd check. Will Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203410 Share on other sites More sharing options...
altemur Posted March 9, 2007 Author Share Posted March 9, 2007 is there an actual image0.jpg...whats in it? I cant se where you set the background colour. havent time to test...but those are the 2 things i'd check. Will the images in $digit_dir = "./digits"; and i do not know where i can set the background color Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-203424 Share on other sites More sharing options...
altemur Posted March 10, 2007 Author Share Posted March 10, 2007 Still waiting for reply. as i said the images are in digits file. thanks advance Quote Link to comment https://forums.phpfreaks.com/topic/41885-creating-images-from-gifs-jpegs-pngs/#findComment-204228 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.