| @@ 547-565 (lines=19) @@ | ||
| 544 | * @param string $buff |
|
| 545 | * @return string |
|
| 546 | */ |
|
| 547 | function saveTemporaryFile($fp, $buff) |
|
| 548 | { |
|
| 549 | $temp_filename = $this->getTmpFilename(); |
|
| 550 | $buff = substr($buff, 9); |
|
| 551 | ||
| 552 | while(!feof($fp)) |
|
| 553 | { |
|
| 554 | $str = trim(fgets($fp, 1024)); |
|
| 555 | $buff .= $str; |
|
| 556 | if(substr($str, -10) == '</content>') break; |
|
| 557 | } |
|
| 558 | ||
| 559 | $buff = substr($buff, 0, -10); |
|
| 560 | ||
| 561 | $f = fopen($temp_filename, "w"); |
|
| 562 | fwrite($f, base64_decode($buff)); |
|
| 563 | fclose($f); |
|
| 564 | return $temp_filename; |
|
| 565 | } |
|
| 566 | ||
| 567 | /** |
|
| 568 | * Replace img tag in the ttxml |
|
| @@ 1144-1165 (lines=22) @@ | ||
| 1141 | * @param resource $fp |
|
| 1142 | * @return string |
|
| 1143 | */ |
|
| 1144 | function saveTemporaryFile($fp) |
|
| 1145 | { |
|
| 1146 | $temp_filename = $this->getTmpFilename(); |
|
| 1147 | $f = fopen($temp_filename, "w"); |
|
| 1148 | ||
| 1149 | $buff = ''; |
|
| 1150 | while(!feof($fp)) |
|
| 1151 | { |
|
| 1152 | $str = trim(fgets($fp, 1024)); |
|
| 1153 | if(trim($str) == '</file>') break; |
|
| 1154 | ||
| 1155 | $buff .= $str; |
|
| 1156 | ||
| 1157 | if(substr($buff,-7)=='</buff>') |
|
| 1158 | { |
|
| 1159 | fwrite($f, base64_decode(substr($buff, 6, -7))); |
|
| 1160 | $buff = ''; |
|
| 1161 | } |
|
| 1162 | } |
|
| 1163 | fclose($f); |
|
| 1164 | return $temp_filename; |
|
| 1165 | } |
|
| 1166 | ||
| 1167 | ||
| 1168 | /** |
|