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

raw support #1113

Closed
slanla opened this issue May 18, 2013 · 4 comments
Closed

raw support #1113

slanla opened this issue May 18, 2013 · 4 comments

Comments

@slanla
Copy link

slanla commented May 18, 2013

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;
 }
}
//---------------------------------------------------------------------------------

@DeepDiver1975
Copy link
Contributor

please submit a pull request - thanks a lot for your contribution!

@mmattel
Copy link

mmattel commented May 27, 2013

Suggestion: check if exiftool is present/accessible and decide if raw conversion is possible. A big feature would be, that conversion time would change something in the browser showing the user conversion is in progress.

You can easily add additional raw formats to the array, please see the list added:

From: http://en.wikipedia.org/wiki/Raw_image_format
And: http://en.wikipedia.org/wiki/ExifTool
(And: http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html)

Adobe Digital Negative DNG *.dng
Canon photo RAW CRW *.crw
Canon photo RAW CR2 *.cr2
CREO Photo RAW *.mos
FUJI photo RAW *.raf
Mamiya photo RAW *.mef
Minolta photo RAW *.mrw
Nikon Electronic format *.nef
Olympus Raw File *.orf
Panasonic photo RAW *.raw
Pentax photo RAW *.pef
Samsung photo RAW *.tiff, *.pef
Sony RAW file *.srf, *.sr2, *.arw

One question, hopefully not stupid, but does this also work when the source folder containing the picture is read only?. I ask because of the statement: $this->image->save($this->path)

@oparoz
Copy link

oparoz commented Jan 24, 2015

Implementation via ImageMagick
owncloud/core#13652

@AddoSolutions
Copy link

Can this be closed then?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants