Help with my image
| From: | hugh danaher | Date: | Mon, 11 Feb 2002 09:14:33 +0000 |
| Subject: | Help with my image | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-84238@lists.php.net to get a copy of this message | ||
Help!
I have attached the code with which I am having difficulty (I have also attached the php
configuration of my host provider).
What is happening is that I can call up a jpeg file from ./maps and see that it makes it through to
the next page, and I can then call the next jpeg file in the sequence, from the same sub-directory,
and I get a broken link (error 500 page). The jpeg's I'm working with are 30 to 100 KB ,
not overly large, and they have names like grid_a.jpg, grid_b.jpg .... grid_l.jpg. The jpeg files
view fine in PhotoShop5.5 and are whole files with proper termination.
It is the inconsistancy of the problem that is driving me nutz. I work on it for a while and get
some images to pass, and then for no reason I can fathom, they stop going through. At one time, I
thought it could be a path problem so I did a copy("./maps/$map","$map") to
get the image file in the same directory as the image program. The jpegs were delivered, but I still
had problems with getting images out. I also thought it could be a database problem, so I stripped
all the records from the table. Still no change, some jpegs got through some delivered the error
500 page.
If anyone is familiar with using the gd files I can certainly use your help. I'm dead in the
water on this.
Thanks,
Hugh
<?php // this is the top line in the page; there are no lines or spaces above here!
header("content-type: image/jpg");
$font="fonts/arial.ttf";
$font2="fonts/wingding.ttf";
$im_size = GetImageSize("./maps/$map");
$imWidth = $im_size[0];
$imHeight = $im_size[1];
$image=imageCreate($imWidth,$imHeight);
$white=imagecolorallocate($image,255,255,255);
$red=imagecolorallocate($image,255,100,100);
$orange=imagecolorallocate($image,255,200,0);
$yellow=imagecolorallocate($image,233,233,0);
$green=imagecolorallocate($image,80,255,80);
$lt_blue=imagecolorallocate($image,180,180,255);
$blue=imagecolorallocate($image,120,120,255);
$dk_blue=imagecolorallocate($image,0,0,200);
$purple=imagecolorallocate($image,200,100,200);
$brown=imagecolorallocate($image,190,160,150);
$black=imagecolorallocate($image,0,0,0);
$image2=imagecreatefromjpeg("./maps/$map");
ImageCopy($image,$image2,0,0,0,0, $imWidth, $imHeight);
// database call works
$db="museum";
$pass="yah_sure_I'm_gonna_tell";
$link=mysql_connect("localhost","","$pass");
if (! $link) die("Can't log in at this time");
mysql_select_db($db,$link) or die ("Can't log in at this time");
$query="SELECT * FROM heritage where map_name='$map' ORDER BY bldg_name ";
$results=mysql_query($query);
if (!$results) die(mysql_error());
mysql_close($link);
// end database call
while ($heritage=mysql_fetch_array($results))
{
$coordinate_x=$heritage['x'];
$coordinate_y=$heritage['y'];
$bldg_use=stripslashes($heritage['bldg_use']);
if ($bldg_use=="Commercial Bldg.") $var_color=$red;
if ($bldg_use=="Government Bldg.") $var_color=$orange;
if ($bldg_use=="other") $var_color=$green;
if ($bldg_use=="Home") $var_color=$lt_blue;
imagettftext($image, 5, 0,$coordinate_x-3, $coordinate_y-4, $black, $font2, "l");
imagettftext($image, 19, 0,$coordinate_x-7, $coordinate_y+4, $black, $font2, "l");
imagettftext($image, 17, 0,$coordinate_x-6, $coordinate_y+2, $black,$font2,"l");
imagettftext($image, 17, 0,$coordinate_x-6, $coordinate_y+2, $var_color, $font2, "l");
imagettftext($image, 5, 0,$coordinate_x-3, $coordinate_y-4, $white, $font2, "l");
}
imagejpeg($image,"./maps2/$map",100);
ImageDestroy($image);
ImageDestroy($image2);
header("location: user_map.php?map=$map");
?> // This is the last line of the page; there are no lines below here.
Configure command:
'./configure' '--with-config-file-path=/etc' '--enable-safe-mode=yes'
'--enable-force-cgi-redirect=yes' '--with-gdbm' '--with-mysql'
'--with-exec-dir=/www/cgi-bin' '--bindir=/www/cgi-bin' '--enable-ftp'
'--enable-trans-sid' '--with-gd=/usr' '--with-zlib=/usr'
'--with-jpeg-dir=/usr' '--enable-gd-native-ttf' '--with-png-dir=/usr'
'--with-ttf=/usr/lib'
When the only tool you have is a hammer, everything looks like a nail.