SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Cedar Hills, Utah
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I do this using PHP?

    Hello,

    I am hoping someone here can tell me how to do this
    using the php_gd2.dll.

    I have things working to create an image on the fly by
    merging two or three images together.

    I however don't want to have to save the image to a file
    using imagepng($image,'filename.png');

    I then need to use <img scr="filename.png"> inside of a table
    to display the image.

    I would like to be able to do the following:

    <img src=$image> inside the table, but, this results in the
    contents of the file being dumped to screen apparently.

    Is there anyone who would know how to get this to work
    with the file creation happening.

    My reasoning is that I don't want to clutter up my directory
    with a lot of one-time used images that others create, I
    would like it to be more dynamic and again not depend on
    a static file being created.

    Thanks for any and all help to this issue.

    Kim Hovorka
    kimhovorka@yahoo.com

  2. #2
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use <img src="generate_the_image.php"> and stream back the gd image from that script
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  3. #3
    SitePoint Enthusiast feti's Avatar
    Join Date
    Jun 2004
    Location
    Northeastern Ohio
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Streaming an image via a PHP is pretty easy. Simply set the content-type, e.g.: header('Content-Type: image/jpeg'); then do a readfile('file.jpeg') call. That's all you need. Add in any security you may need if it's required. Notice that the content-type and file are going to differ in your scenario.
    feti
    Mojavi Project - Mojavi 3.0.0-dev available now!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •