How to email a image in attachment

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

    How to email a image in attachment

    I create an image on the fly, and want to email it to the receiver.
    But I can't. Since the php mail function needs string as message to
    send the the message, but I only get my gd resource object, how can I
    get the string presentation of the GD resourse.
    BTW:I don't want to save it as a file first, then read from file.
  • Alvaro G Vicario

    #2
    Re: How to email a image in attachment

    *** wilson galaxy wrote/escribió (25 Oct 2004 08:46:02 -0700):[color=blue]
    > I create an image on the fly, and want to email it to the receiver.
    > But I can't. Since the php mail function needs string as message to
    > send the the message, but I only get my gd resource object, how can I
    > get the string presentation of the GD resourse.
    > BTW:I don't want to save it as a file first, then read from file.[/color]

    The mail() function is pretty simple. Unless you are willing to write all
    code from scratch, you'd better find a class with support from MIME
    attachments. Check here:




    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- Thank you for not e-mailing me your questions
    --

    Comment

    • Manuel Lemos

      #3
      Re: How to email a image in attachment

      Hello,

      On 10/25/2004 12:46 PM, wilson galaxy wrote:[color=blue]
      > I create an image on the fly, and want to email it to the receiver.
      > But I can't. Since the php mail function needs string as message to
      > send the the message, but I only get my gd resource object, how can I
      > get the string presentation of the GD resourse.
      > BTW:I don't want to save it as a file first, then read from file.[/color]

      You may want to try this class that lets you compose and send messages
      with attached images or even embedded in HTML message body if you would
      like that:




      --

      Regards,
      Manuel Lemos

      PHP Classes - Free ready to use OOP components written in PHP
      Free PHP Classes and Objects 2025 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


      PHP Reviews - Reviews of PHP books and other products


      Metastorage - Data object relational mapping layer generator

      Comment

      • yiyongpan@yahoo.com

        #4
        Re: How to email a image in attachment

        Thanks guy!!
        My issue is I don't have a real file of this image, all I have is a gd
        resource object, It seems all mail functions require either the file
        name, or the string presentation of the image file. And I can not find
        a way to get the string presentation of my gd resource. I am in php 4
        not php 5 .

        Thanks

        Comment

        • Manuel Lemos

          #5
          Re: How to email a image in attachment

          Hello,

          On 10/25/2004 04:38 PM, yiyongpan@yahoo .com wrote:[color=blue]
          > Thanks guy!!
          > My issue is I don't have a real file of this image, all I have is a gd
          > resource object, It seems all mail functions require either the file
          > name, or the string presentation of the image file. And I can not find
          > a way to get the string presentation of my gd resource. I am in php 4
          > not php 5 .[/color]

          No, the MIME message can also take data in strings to add as
          attachments. The example demonstrates that.

          As for capturing the GD output as a string, try using output buffering:

          ob_start()
          ImageGIF($im);
          $image_data=ob_ get_contents();

          --

          Regards,
          Manuel Lemos

          PHP Classes - Free ready to use OOP components written in PHP
          Free PHP Classes and Objects 2025 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


          PHP Reviews - Reviews of PHP books and other products


          Metastorage - Data object relational mapping layer generator

          Comment

          Working...