NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
First steps


Joined: 01 Sep 2009
Posts: 2
Reply with quote
Hi,

I am currently very new to the use of nusoap.

I tried to send an image from the client doing this:

Code:

$file = "Foto.jpg";
   if($fp = fopen($file,"rb", 0)){
      $picture = fread($fp,filesize($file));
      fclose($fp);
      // base64 encode the binary data, then break it
      // into chunks according to RFC 2045 semantics
      $picture_base64 = chunk_split(base64_encode($picture));
   }


But a echo '<img src="data:image/gif;base64,'.$picture_base64 .'">'; to test it, gives me only a half picture back?

Then on server side:

(very simple for testing)

Code:

function item_image($image){
         if(!empty($image)){
            $picture = base64_decode($image);
            // copy locally
            copy($picture, "bilder/img_".$l_id."");
            return 1;
         }else{
            return 0;
         }
      }


But the picture never arrives.

Is there anybody outside having experience about transfering pictures?
A little help would be so great!

Thanks
Heohni
View user's profileFind all posts by heohniSend private message


Joined: 01 Sep 2009
Posts: 2
Reply with quote
correct is this:

Code:

if($fp = fopen("4000768.jpg", "r")){
      $image = "";
      while (!feof($fp)){
         $image .= fread($fp,1024);
      }
      $picture_base64 = base64_encode($image);
}
View user's profileFind all posts by heohniSend private message
First steps
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic