Changeset 873 for pro-violet-viettel
- Timestamp:
- Apr 1, 2015 4:55:43 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php
r861 r873 162 162 return $item; 163 163 } 164 165 private function createPreview($fileurl, $userId, $fileid) { 166 $url = "https://docs.google.com/gview?url=" .urlencode($fileurl) . ""; 167 file_put_contents("1.html", $url); 168 $content=""; 169 $ch = curl_init(); 170 curl_setopt($ch, CURLOPT_URL, $url); 171 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); 172 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 173 $content = curl_exec($ch); 174 file_put_contents("1.html", $content); 175 preg_match("'img\?id\\\u003d(.*?)%3D'si", $content, $matches); 176 $count=0; 177 if (isset($matches[1])) 178 { 179 $id = $matches[1]; 180 $count=0; 181 for ($i = 0; $i <= 20; $i++) { 182 $imgurl = "https://docs.google.com/viewerng/img?id=" . $id . "&w=600&page=" . $i; 183 $ch = curl_init(); 184 curl_setopt($ch, CURLOPT_URL, $imgurl); 185 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); 186 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 187 $image = curl_exec($ch); 188 $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 189 if ($code == 200) 190 { 191 192 $count++; 193 if (!file_exists('previews/'. $userId."/")) { 194 mkdir('previews/'. $userId."/", 0777, true); 195 } 196 197 if (!file_exists('previews/'. $userId."/".$fileid."/")) { 198 199 mkdir('previews/'. $userId."/".$fileid."/", 0777, true); 200 201 } 202 file_put_contents("previews/" . $userId . "/" . $fileid . "/" . $i . ".png", $image); 203 204 } else { 205 break; 206 } 207 } 208 209 } 210 return $count; 211 } 212 164 213 public function executePreview(){ 165 214 $fileId = $this->getRequestParameter('fileId'); … … 428 477 } 429 478 430 private function createPreview($fileurl, $userId, $fileid) {431 432 433 $url = "https://docs.google.com/gview?url=" .urlencode($fileurl) . "";434 file_put_contents("1.html", $url);435 $content="";436 $ch = curl_init();437 curl_setopt($ch, CURLOPT_URL, $url);438 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);439 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);440 $content = curl_exec($ch);441 file_put_contents("1.html", $content);442 preg_match("'img\?id\\\u003d(.*?)%3D'si", $content, $matches);443 $count=0;444 if (isset($matches[1]))445 {446 $id = $matches[1];447 $count=0;448 for ($i = 0; $i <= 20; $i++) {449 $imgurl = "https://docs.google.com/viewerng/img?id=" . $id . "&w=600&page=" . $i;450 $ch = curl_init();451 curl_setopt($ch, CURLOPT_URL, $imgurl);452 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);453 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);454 $image = curl_exec($ch);455 $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);456 if ($code == 200)457 {458 459 $count++;460 if (!file_exists('previews/'. $userId."/")) {461 mkdir('previews/'. $userId."/", 0777, true);462 }463 464 if (!file_exists('previews/'. $userId."/".$fileid."/")) {465 466 mkdir('previews/'. $userId."/".$fileid."/", 0777, true);467 468 }469 file_put_contents("previews/" . $userId . "/" . $fileid . "/" . $i . ".png", $image);470 471 } else {472 break;473 }474 }475 476 }477 return $count;478 }479 480 479 public function executeSave() { 481 480 $content = file_get_contents('php://input'); … … 546 545 return sfView::NONE; 547 546 } 547 548 548 public function executeGetFiles() 549 549 { 550 550 $tblfile = TblspacefilePeer::retrieveByPk(64); 551 551 print_r($tblfile); 552 return sfView::NONE;552 return sfView::NONE; 553 553 } 554 554 }
Note: See TracChangeset
for help on using the changeset viewer.