Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8318389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:57:13+00:00 2026-06-08T21:57:13+00:00

I want to send an image from android and save it trought a php

  • 0

I want to send an image from android and save it trought a php code in my server. Because I need to protect my server I need to reprocess the image so I have to use GD or Imagick. Image is sent encoded in base64. In the php file is decoded and if I use:

$img=base64_decode($img);
$file = fopen('test.jpg', 'wb');
fwrite($file, $img);
fclose($file);

image is saved in the server. If I use Imagick or GD my image isn’t saved and the php files returns nothing, even if I insert an echo after it. Any help? In GD I was using:

$img=base64_decode($img);
$imageinfo = getimagesize($img);
if($imageinfo['mime'] == 'image/gif'{
    $img = @imagecreatefromjpeg($img);
    imagejpeg($img, ""testt.jpg", 80);
}

and in Imagick:

$img=base64_decode($img);
$img = imagick($img); //neither if I use a path of an image saved in my server 
                      //works
$mime = mime_content_type($img);
    switch ($mime):
        case 'image/jpeg':
            $ext = '.jpg';
            break;
    endswitch;

$img->stripImage();
$img->writeImage(""testt".$ext);
$img->clear();
$img->destroy();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:57:15+00:00Added an answer on June 8, 2026 at 9:57 pm

    imagick only works on files, you can’t give a handle to it unfortunately, so:

    $img=base64_decode($img);
    $filename = tempnam(sys_get_temp_dir(), 'tempimage_'); 
    $file = fopen($filename, 'wb');
    fwrite($file, $img);
    fclose($file);
    
    $img = imagick($filename);  
    $mime = mime_content_type($img);
        switch ($mime):
            case 'image/jpeg':
                $ext = '.jpg';
                break;
       endswitch;
    
    $img->stripImage();
    $img->writeImage("testt".$ext);
    $img->clear();
    $img->destroy();
    

    This, in theory, should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send image and text data from Android phone to a Server.
I want to send video/images from the android mobile to a server and recieve
I want to send more than one image file from client to server for
I want to send an image from one android device to one or multiple
i want a two communication between server and Android. From Android want to send
I have some image data (jpeg) I want to send from my iPhone app
How can i send image from the client side to server? i have a
Hello Sir i want send list of data to php server i use following
I want to send down a webpage from a server to WebView components on
I would like to capture an image from the camera on Android, and send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.