Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. public function actionRecreateMultires($panorama_id)
  2. {
  3. /** @var PanoramaService $panoramaService */
  4. $panoramaService = \Yii::app()->panorama;
  5.  
  6. /** @var Panorama $panorama */
  7. $panorama = \Panorama::model()->findByPk($panorama_id);
  8.  
  9. $s3 = new S3(Yii::app()->s3->aKey, Yii::app()->s3->sKey);
  10.  
  11. if ($panorama) {
  12. $saveTo = Yii::app()->storage->getUploadDirPath() . $panorama->filename;
  13. echo "Trying to get original from S3 and save it to $saveTo\n";
  14. $s3result = $s3->getObject(Yii::app()->assetManager->bucket, 'upload/'.$panorama->filename, $saveTo);
  15.  
  16. if ($s3result && empty($s3result->error)) {
  17. echo "All systems OK, we are ready to send task...\n";
  18. $panoramaService->convertPanoramaMultires($panorama, PanoramaService::TILE_SIZE);
  19. echo "Task sended to workers. Work complete.\n";
  20. }elseif(!$s3result || $s3result->error){
  21. var_dump($s3result);
  22. }
  23.  
  24. } else {
  25. echo "Panorama with ID $panorama_id doesn't exists\n";
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement