[RESOLVED] Saving Base64 image.
Results 1 to 3 of 3

Thread: [RESOLVED] Saving Base64 image.

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    15

    resolved [RESOLVED] Saving Base64 image.

    Hello, I would like to know if one of you can help out.

    I need to convert base64 code into a jpg image and save it to a folder within my server as a jpg image.

    Whats the best way to do this?

    $string contains the base64 code of the image.

    I have been able to display the base64 image online in a html page. But i can't seem to find any code to convert base64 into jpg and save it to a folder.

    I would be very grateful if one of u can help out with this.

    Thank you

  2. #2
    High Energy Magic Dept. NogDog's Avatar
    Join Date
    Aug 2006
    Location
    Ankh-Morpork
    Posts
    14,541
    PHP Code:
    $img imagecreatefromstring(base64_decode($string));
    if(
    $img != false)
    {
       
    imagejpeg($img'/path/to/new/image.jpg');

    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Junior Member
    Join Date
    Jul 2008
    Posts
    15
    Thanks man. That did the trick.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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