You are here: Re: PHP Version 5.1.6 versus PHP Version 4.3.10 « All PHP « IT news, forums, messages
Re: PHP Version 5.1.6 versus PHP Version 4.3.10

Posted by bill on 01/23/07 15:39

bill wrote:
> The following code works ok in php 5.1.6 but doesnt return an image in
> 4.3.10.
> put this code in the form where the image is being placed.
> <img src="random.php?str=<?php echo $str; ?>" alt="capture image"
> width="60" height="20" vspace="1" align="top" />
>
> This is the random.php code
>
> <?php
> $str = $_GET['str'];
>
> $imgX = 60;
> $imgY = 20;
> $image = imagecreatetruecolor(60, 20);
>
> $backgr_col = imagecolorallocate($image, 238,239,239);
> $border_col = imagecolorallocate($image, 208,208,208);
> $text_col = imagecolorallocate($image, 46,60,31);
>
> imagefilledrectangle($image, 0, 0, 60, 20, $backgr_col);
> imagerectangle($image, 0, 0, 59, 19, $border_col);
>
> $font = "VeraSe.ttf";
> $font_size = 11;
> $angle = 5;
> $box = imagettfbbox($font_size, $angle, $font, $str);
> $x = (int)($imgX - $box[4]) / 2;
> $y = (int)($imgY - $box[5]) / 2;
> imagettftext($image, $font_size, $angle, $x, $y, $text_col, $font, $str);
>
> header("Content-type: image/png");
> imagepng($image);
> imagedestroy ($image);
>
> ?>
> Is there something I have to do to so that the imaged is returned when
> using 4.3.10. The isp who is hosting the website is using this version
> so I have to adapt to suit.
> Please can someone help I have spent hours trying to work round this.
> Thanks
> bill

Sorry got it working. The font was causing the problem.

Thanks for looking

bill

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация