Blame view

sources/apps/reader/ajax/canvas_saver.php 681 Bytes
42e4f8d60   Kload   add all apps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  <?php
      // Get the data
     $imageData=$_POST['canv_data'];	
     $title = rtrim($_POST['title'],'pdf');
     $location = urldecode(dirname($_POST['location']));
    
     if($location != '/')
  	$location = $location.'/';
      $filteredData=substr($imageData, strpos($imageData, ",")+1);
      $owner = OCP\USER::getUser();
  	$save_dir = OCP\Config::getSystemValue("datadirectory").'/'. $owner .'/reader';	
      $save_dir .= $location;
  	$thumb_file = $save_dir . $title;
  	if (!is_dir($save_dir)) {		
  		mkdir($save_dir, 0777, true);
  	}
  	$image = new OC_Image($filteredData);
  	if ($image->valid()) {
  		$image->centerCrop(100);
  		$image->fixOrientation();
  		$image->save($thumb_file.'png');
  	}
  ?>