473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 2064
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Wayne | last post by:
I have a script that uses filesystemobject that reads files from a given path, in my case images. It is running on a server that is 2000 adv svr w/ all current patches. The script prior to some...
3
by: Simon | last post by:
This problem has been driving me mad for months.... Seen a few posts on forums about it but no answers... No mention on MSDN etc. XP Pro SP1, VS.NET (c#) .Net framework 1.1, IIS 5.1. In a...
10
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images....
6
by: wattanabi | last post by:
Greetings, I'm attempting to layout a bunch of images in a grid using DIV's instead of a table. I currently have a 3x6 table that I need to convert to css. I've seen various example of a 3 to 4...
2
by: mouseit101 | last post by:
Hi, I'm writing a script that would (hopefully) search google images for whatever, and then return a list of URLs for the image. Right now I have: $dom = new DomDocument(); $url =...
0
by: Frenchie | last post by:
Hi, I have created a very neet menu from an example found on the MSDN library at: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.menuitembinding.imageurlfield.aspx My...
1
by: Cerebral Believer | last post by:
Hi folks, I am using the following code for mouse over (roll-overs) in my XHTML code. <a onmouseover="document.getElementById('sitemap').src = '../images/buttons/sitemap_mo.jpg';"...
4
toxicpaint
by: toxicpaint | last post by:
Hi, can anyone give me a hand. I'm currently displaying 4 random images at the top of a page. I did this using an array of 35 pictures and then writing them to page. The problem I have is that in...
5
by: remon87 | last post by:
I need some help. I have javasript that creates the submenu but it works if I have a text with css. I need it to do the same with a roll over images. so when I click on the image the submenu...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.