[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
    13,943
    PHP Code:
    $img imagecreatefromstring(base64_decode($string));
    if(
    $img != false)
    {
       
    imagejpeg($img'/path/to/new/image.jpg');

    Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." ~ from Nation, by Terry Pratchett

    "But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because hes a better programmer now!" ~ http://www.oreillynet.com/ruby/blog/...ck_to_p_1.html


    eBookworm.us

  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
  •