# Generating an image, saving to hard drive

**URL:** <https://forum.kirupa.com/t/generating-an-image-saving-to-hard-drive/319892>\
**Category:** programming\
**Created:** [March 8, 2011, 3:57am UTC](https://forum.kirupa.com/t/generating-an-image-saving-to-hard-drive/319892 "2011-03-08T03:57:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![H4T](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/h4t/32/329_2.png) [@H4T](https://forum.kirupa.com/u/H4T)\
**Post date:** [March 8, 2011, 3:57am UTC](https://forum.kirupa.com/t/generating-an-image-saving-to-hard-drive/319892/1 "2011-03-08T03:57:46Z")

</div>

I’m working on an interactive kiosk application for a children’s museum, and have been having a hell of a time getting this last and final piece working. I created a feature in my main kiosk application (written entirely in AS3) that lets a user take an image from a webcam stream, then fill in some basic information and (attempt to) send an e-mail. The e-mail will b a “postcard” from the kid to their parents, through the kiosk.

I am able to capture and pass the webcam image just fine off to an external (but local) PHP script, but no matter how I try it, I can’t get PHP to generate the image to a jpeg **without a prompt**.

This PHP script uses PHPMailer to send an e-mail, and my hope was to attached an external image to the PHPMailer e-mail using AddEmbeddedImage. However, I am having a very hard time getting PHP to create the image silently so that the script can just point to it on the hard drive and attach it.

I have tried:

1. A separate PHP script that takes the encoded ByteArray from AS3, sets up headers to be a “jpeg” and then echos the bytearray.
2. fopen, fwrite, fclose to make the image

I need this solution to be completely transparent to the user and not require any user input for file locations. However, each method prompts the user to save a file somewhere, which will confuse any user of the kiosk.

I am in desperate need of a solution, I’ve been working on this for far too long! Thanks!
