470,815 Members | 1,175 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

images

I tried to run the following piece of code :
<?php
$im = imagecreatefrompng("map.png");
imagepng($im);
?>
map.png being a file in the same directory as my php files, im fairly sure
that the gd library works, im using a teaching webserver and some of the
other example iv tried from the php website have worked fine. is their
something wrong with my code?

Thanks David

ps My ultimate aim is to use a map of the uk and then using data from a db
create regions on that map using php, any tips here are appreciated as well
Jul 17 '05 #1
4 1961
David wrote:
I tried to run the following piece of code :
<?php
$im = imagecreatefrompng("map.png");
header('Content-Type: image/png');

imagepng($im);
?> (snip) ps My ultimate aim is to use a map of the uk and then using data from a db
create regions on that map using php, any tips here are appreciated as well


What do you mean with "regions"?
And how will you map data from the DB to pixels in the image?
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
My plan is for postgres to hold an array of polygons (points), php will grab
these numbers and using the imagepolygon function paste (if thats the
correct word) these shapes on to a map of the uk, showing where a particular
species of fish can be found.

I just had a test run and it printed a triangle on to a jpeg i gave it, only
problem was the colour didnt seem to come through correctly ideas?

David

ps Cheers for the pointer before, it did help :)
What do you mean with "regions"?
And how will you map data from the DB to pixels in the image?
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--

Jul 17 '05 #3
David wrote:
My plan is for postgres to hold an array of polygons (points), php will grab
these numbers and using the imagepolygon function paste (if thats the
correct word) these shapes on to a map of the uk, showing where a particular
species of fish can be found.
Ah, ok. Easy enough :)

I just had a test run and it printed a triangle on to a jpeg i gave it, only
problem was the colour didnt seem to come through correctly ideas?


Instead of imagecolorallocate() try imagecolorresolve()

I'm not sure why it doesn't work but I think it has something to do with
the palette entries.
I tried a red line with imagecolorallocate() and it came out blueish;
I then tried it with imagecolorresolve() and it came out some sort of
dark pink.

I guess it depends on the image you're working with.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #4
Some times, when I am having trouble with colors, I create a blank image of
the same size, fill() the image with a color such as white, then define that
as transperant. Now I draw all I want with my colors (becouse its a new
image, I have the pallete to myself). When done, I copy my drawing ontop of
the original image, thus preserving all colors.

Just a hack I do.

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"David" <de*@ukc.ac.uk> wrote in message
news:c0**********@athena.ukc.ac.uk...
My plan is for postgres to hold an array of polygons (points), php will grab these numbers and using the imagepolygon function paste (if thats the
correct word) these shapes on to a map of the uk, showing where a particular species of fish can be found.

I just had a test run and it printed a triangle on to a jpeg i gave it, only problem was the colour didnt seem to come through correctly ideas?

David

ps Cheers for the pointer before, it did help :)
What do you mean with "regions"?
And how will you map data from the DB to pixels in the image?
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--


Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Simon | last post: by
10 posts views Thread by Neo Geshel | last post: by
2 posts views Thread by mouseit101 | last post: by
reply views Thread by Frenchie | last post: by
1 post views Thread by Cerebral Believer | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.