Commit 18e2ed76 authored by mku's avatar mku

ZP-150 #comment Inline images can not be downloaded with Windows Phone 7.5 or...

ZP-150 #comment Inline images can not be downloaded with Windows Phone 7.5 or Samsung Galaxy S2 #time 10h

git-svn-id: https://z-push.org/svn/z-push/trunk@1372 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 12c324d9
......@@ -48,6 +48,7 @@ class MAPIStreamWrapper {
private $mapistream;
private $position;
private $streamlength;
private $streampad = 0; // pad stream with 0 string for stream converter (streamlength must be multiple of 4)
/**
* Opens the stream
......@@ -75,6 +76,11 @@ class MAPIStreamWrapper {
// get the data length from mapi
$stat = mapi_stream_stat($this->mapistream);
$this->streamlength = $stat["cb"];
// pad the stream to the multiple of 4
if ($this->streamlength % 4 != 0 )
$this->streampad = $this->streamlength + 4 - ($this->streamlength % 4);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("MAPIStreamWrapper::stream_open(): initialized mapistream: %s streamlength: %d", $this->mapistream, $this->streamlength));
return true;
......@@ -91,6 +97,9 @@ class MAPIStreamWrapper {
public function stream_read($len) {
$data = mapi_stream_read($this->mapistream, $len);
$this->position += strlen($data);
if ($this->position == $this->streamlength && $this->streampad != 0 )
$data = str_pad($data, $this->streampad, 0x0);
return $data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment