dynamically created image into string

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

    dynamically created image into string

    i have a dynamically created image represented by an imagehandler, but
    i don't wanna output to the browser or a file. is it possible to read
    that image directly into a string?

    any help appreciated, micha
  • chotiwallah

    #2
    found the solution myself

    chotiwallah@web .de (chotiwallah) wrote in message news:<782d6cb.0 407150117.318e7 2f@posting.goog le.com>...[color=blue]
    > i have a dynamically created image represented by an imagehandler, but
    > i don't wanna output to the browser or a file. is it possible to read
    > that image directly into a string?
    >
    > any help appreciated, micha[/color]

    in case anyone faces a similar problem and is interested:

    ob_start();
    imagepng($ih);
    $imagedata = ob_get_contents ();
    ob_end_clean();

    imagepng without an png-header just prints the image data as text in
    the browser. so i buffer the output, read it into $imagedata, clean
    out the bufer and end buffering

    micha

    Comment

    • Anders K. Madsen

      #3
      Re: found the solution myself

      On 17 Jul 2004 06:38:26 -0700
      chotiwallah@web .de (chotiwallah) wrote:

      [snip]

      Can be done a line shorter with:
      ob_start();
      imagepng($ih);
      $imagedata = ob_get_clean();

      ;-)

      --
      Anders K. Madsen --- http://lillesvin.linux.dk

      "There are 10 types of people in the world.
      Those who understand binary - and those who don't."

      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.2.4 (GNU/Linux)

      iD8DBQFA+TXElNH Je/JASHcRAu2FAJwMk 0RBGuudJ5WwSACc GGSG5T2qTwCfWyY F
      bCBSxxopVEWwvX0 Q6EIaZS4=
      =/IGV
      -----END PGP SIGNATURE-----

      Comment

      Working...