| @@ 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 |
|
| @@ 1204-1225 (lines=22) @@ | ||
| 1201 | * @param resource $fp |
|
| 1202 | * @return string |
|
| 1203 | */ |
|
| 1204 | function saveTemporaryFile($fp) |
|
| 1205 | { |
|
| 1206 | $temp_filename = $this->getTmpFilename(); |
|
| 1207 | $f = fopen($temp_filename, "w"); |
|
| 1208 | ||
| 1209 | $buff = ''; |
|
| 1210 | while(!feof($fp)) |
|
| 1211 | { |
|
| 1212 | $str = trim(fgets($fp, 1024)); |
|
| 1213 | if(trim($str) == '</file>') break; |
|
| 1214 | ||
| 1215 | $buff .= $str; |
|
| 1216 | ||
| 1217 | if(substr($buff,-7)=='</buff>') |
|
| 1218 | { |
|
| 1219 | fwrite($f, base64_decode(substr($buff, 6, -7))); |
|
| 1220 | $buff = ''; |
|
| 1221 | } |
|
| 1222 | } |
|
| 1223 | fclose($f); |
|
| 1224 | return $temp_filename; |
|
| 1225 | } |
|
| 1226 | ||
| 1227 | ||
| 1228 | /** |
|