Reputation: 7615
I am working on application where input files having extension .tif(Tagged Image File Format (TIFF)). The basic problem is to display .tif files in all browser which is not applicable on all major browsers. The solution i have accept is to convert them into png
I have am converting .tif file to png using http://image.intervention.io/api/encode in PHP Laravel 5.5
Image intervention is depends on imagick for tif encoding, i have installed this dependency but the encoding scheme is converting/display/store first image from tif file, not all files.
Can any one have solution from tif to PNG or PDF conversion using any PHP library?
Upvotes: 0
Views: 1334
Reputation: 7615
I found very nice article here, the approach to solve this problem is,
$file = Storage::disk('s3')->get(request()->file_name);
$file_pdf =storage_path("app/bundle/tmp/".end($name).".pdf");
$document =new \Imagick();
$document->readImageBlob($file);
if (!$document->writeImages($file_pdf, true)) {
echo "Unable to write the file";
} else {
$document->clear();
}
return response()->file($file_pdf)->deleteFileAfterSend(true);
I have read s3 file stream using laravel storage and pass that blob using Imagick readImageBlob()
method. The state of the art is $document->writeImages("to_pdf.pdf")
file. At the end you can clear the file variable
Upvotes: 1
Reputation: 682
My suggestion is: You have to use gdal2tiles.py to convert your .tif file into .png.
When you run this command its create an output folder, in which you get openlayers.html file, open it and see your .tif file in every browser easily.
If you need any help related to this, do comment. I'll guide you.
Upvotes: 0