• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 513
  • Last Modified:

Save Image To Server

Hi I have this script below that will show the image of whats in an email.

$g="/9j/4AAQSkZJRgABAgEBLAEsAAD/4RVORXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEa
AAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAdAAAAcgEyAAIAAAAU";

header("Content-Type: image/jpeg");
$g=imap_base64($g);

echo $g


how would I be able to save the image to the server?
0
eNarc
Asked:
eNarc
1 Solution
 
eNarcAuthor Commented:
Found it :D

header("Content-Type: image/jpeg");
$g=imap_base64($g);

$url = $g;//file_get_contents("http://www.php.net/");
$fp = fopen("1.jpg", 'w');
fwrite($fp, $url);
fclose($fp);


and this will save the file :D awesome :D I'm totally answering my own questions here :D lol
0
 
karlwilburCommented:
Awesome!!
$fp = fopen("1.jpg", 'w');
fwrite($fp, imap_base64($g));
fclose($fp);

Open in new window

0
 
ee_autoCommented:
Question PAQ'd, 500 points refunded, and stored in the solution database.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now