简体   繁体   中英

Storing photo(not link of the photo) in client/browser side

Anyone know any ways or tutorials to store photos retrieved by php(not the link of the photo), in client/browser side for further photo editing? Thanks.

Edit: Actually, I am trying to create facebook apps that do photo editing. I already retrieve facebook photo and I want to let user edit the photo multiple times before they decided to save and upload the edited photo back to facebook. While user is editing,I need a way to store original photo and edited photos in somewhere before user decided to save. I don't want to save the edited photos in the server storage every time user change something as it might be heavy for the server. So,I want original photo and edited photos to store in somewhere that is not on server storage. Is it possible? I am using php gd and am pretty new to web programming.

Please help. Thx a lot.

You are probably looking for a way to force a download of a file instead of displaying it.

Try using this before sending the photo-binary:

$datei = 'filename.jpg';

header("Expires: 0"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Content-Type: application/force-download"); 
header("Content-Description: File Transfer"); 
header("Content-Disposition: attachment; filename=$datei"); 
header("Content-Transfer-Encoding: binary"); 

//Output image here (for example by using imagepng() when using gd)

Edit: You can't save an image to the user's browser and then retrieve it easily with your server application. You will need to store it on the server. If your server's space is limited you might want to look into cloud-hosting services like Amazon S3 where you can put literally unlimited images for a small cost providing you delete them afterwards and clobber the space.

Check this link http://developer.yahoo.com/performance/rules.html#expires

You can do it using .htaccess file. Code should be some thing like,

<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    ExpiresActive On
    ExpiresDefault A259200000
    Header set Expires "Thu, 15 Apr 2013 20:00:00 GMT"
</filesMatch>

For more info http://www.askapache.com/htaccess/using-http-headers-with-htaccess.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM