# Loading image into flash through php

**URL:** https://forum.kirupa.com/t/loading-image-into-flash-through-php/112978
**Category:** Uncategorized
**Created:** [June 13, 2004, 8:54pm UTC](https://forum.kirupa.com/t/loading-image-into-flash-through-php/112978 "2004-06-13T20:54:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sequence](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@sequence](https://forum.kirupa.com/u/sequence)
#### Post date: [June 13, 2004, 8:54pm UTC](https://forum.kirupa.com/t/loading-image-into-flash-through-php/112978/1 "2004-06-13T20:54:30Z")

</div>

Hello, I have a question (surprise :-)). My goal is to load images from a directory on my webserver into flash. The problem is that I want the images folder to be protected by .htaccess that prevents direct access to that folder, and therefore I cannot directly load the image into flash by URL. My thought is that I need to use an intermediary, php, to direct the image request to the server-side script so that it will return an image to me; the php would be able to access the images because it is going to be an internal operation rather than cross domain direct request. The question is how do I request an image from php and load it into flash; the name of the desired picture is, of course, known from a database.

```
         Thanks ahead.

                    sequence.
```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [June 16, 2004, 6:28pm UTC](https://forum.kirupa.com/t/loading-image-into-flash-through-php/112978/2 "2004-06-16T18:28:10Z")

</div>

> [@Hans Kilian](#):
>
> \<?php  
> header(“Content-type: image/jpeg”);  
> $im = imagecreatefromjpeg(“protected/image.jpg”);  
> imagejpeg($im);  
> ?\>
> 
> And be sure not to output _anything_ before the script as that will output headers for a normal web page.

Hey Hans, it worked very nicely, thanks. I am wondering whether it is possible to do this vice versa; can flash send image object to php so it can then convert it to image file and save on server? Or must I use file form in html to upload pictures?

```
                  Thanks ahead.

                        Sequence.

```
