images

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    images

    I tried to run the following piece of code :
    <?php
    $im = imagecreatefrom png("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


  • Pedro Graca

    #2
    Re: images

    David wrote:[color=blue]
    > I tried to run the following piece of code :
    > <?php
    > $im = imagecreatefrom png("map.png");[/color]

    header('Content-Type: image/png');

    [color=blue]
    > imagepng($im);
    > ?>[/color]
    (snip)[color=blue]
    > 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[/color]

    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 =--

    Comment

    • David

      #3
      Re: images

      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 :)
      [color=blue]
      > 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 =--[/color]


      Comment

      • Pedro Graca

        #4
        Re: images

        David wrote:[color=blue]
        > 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.[/color]

        Ah, ok. Easy enough :)

        [color=blue]
        > 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?[/color]

        Instead of imagecoloralloc ate() try imagecolorresol ve()

        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 imagecoloralloc ate() and it came out blueish;
        I then tried it with imagecolorresol ve() 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 =--

        Comment

        • CountScubula

          #5
          Re: images

          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" <de4@ukc.ac.u k> wrote in message
          news:c0dloc$hud $1@athena.ukc.a c.uk...[color=blue]
          > My plan is for postgres to hold an array of polygons (points), php will[/color]
          grab[color=blue]
          > 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[/color]
          particular[color=blue]
          > species of fish can be found.
          >
          > I just had a test run and it printed a triangle on to a jpeg i gave it,[/color]
          only[color=blue]
          > problem was the colour didnt seem to come through correctly ideas?
          >
          > David
          >
          > ps Cheers for the pointer before, it did help :)
          >[color=green]
          > > 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 =--[/color]
          >
          >[/color]


          Comment

          Working...