Skip to content
This repository was archived by the owner on Nov 14, 2018. It is now read-only.
This repository was archived by the owner on Nov 14, 2018. It is now read-only.

raw support #1113

@slanla

Description

@slanla

I has modify the gallery's code (thumbnail.php and image.php) to allow the browser display raw files.
The environment of os need to install exiftool.
For ubuntu, you should be use "sudo apt-get install exiftool" to install exiftool.
Applying the modify code, the browser would be display raw file correctly,
However, for ios app, the ownCloud app could not display raw file correct.
It is need to modify of app by owncloud's authorities.

//---------------------------------------------------------------------------------
in gallery/lib/thumbnail.php: line 52
//---------------------------------------------------------------------------------
if(in_array(strtolower($extension),array("nef","orf")))
{
 $this->path = $galleryDir . $image . '.jpg';
 $jpgfile = $galleryDir . $image . '_o.jpg';    
 $img=$this->view->getLocalFile($imagePath);
 if (!file_exists($this->path)) 
 {
  //raw file to jpg
  $cmd="exiftool -b -JpgFromRaw "{$img}" > "{$jpgfile}"";  //need exiftool
  system("$cmd");
  //jpg to thumbnail
  $this->image = new \OC_Image($jpgfile);
  if ($this->image->valid()) {
   $this->image->fixOrientation();
   if ($square) {
    $this->image->centerCrop(200);
   } else {
    $this->image->fitIn(400, 200);
   }
   $this->image->save($this->path);
  }
 }
}
else
 $this->path = $galleryDir . $image . '.' . $extension; //original line number 52

//---------------------------------------------------------------------------------
in gallery/ajax/image.php: line 30
//---------------------------------------------------------------------------------
$extension=strtolower(pathinfo($img,PATHINFO_EXTENSION));
if(in_array($extension,array("nef","orf")))
{
 $main_filename=pathinfo($img,PATHINFO_FILENAME);
 $galleryDir = \OC_User::getHome($owner) . '/gallery/' . $owner . '/';
 $img_path=dirname($img);
 $jpg="{$galleryDir}/{$img_path}/{$main_filename}_o.jpg"; 
 if(file_exists($jpg))
 {  
  header('Content-Type: image/jpeg');
readfile($jpg);
  exit;
 }
}
//---------------------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions