I did the exact same page using Imagick. I was successful in converting TIFF, DNG, CR2 files into JPEG. Before you do this, you must refer to this video https://www.youtube.com/watch?v=q3c6O85_LoA&index=29&list=LLkmyV_KYAFxKz9gE_fEbjTA&t=23s
Here is a code with JavaScript, HTML and PHP:
<?php
$file=$_FILES['file'];
$fname=$_FILES['file']['name'];
$ftmp=$_FILES['file']['tmp_name'];
$ferr=$_FILES['file']['error'];
$check=explode(".",$fname);
$ext=end($check);
if(!$ftmp)
{
//echo"ERROR: Please select a file first!";
?>
<html>
<script>
alert("ERROR: Please select a file first!");
location.href='/Image/1.html';
</script>
</html>
<?php
}
else if(!preg_match("/\.(tif|tiff|cr2|pef|nef|dng)$/i",$fname))
{
//echo"ERROR: File is not in TIF,TIFF,CR2,PEF,NEF or DNG</br>";
//echo"File is of $ext format";
?>
<html>
<script>
alert("ERROR: File is not in TIF,TIFF,CR2,PEF,NEF or DNG");
location.href='/Image/1.html';
</script>
</html>
<?php
}
else
{
//echo".$ext File uploaded";
?>
<html>
<script>
alert("File uploaded");
</script>
</html>
<?php
$im=new Imagick($ftmp);
$im->setImageFormat('jpg');
file_put_contents("/var/www/html/Image/Converted/a.jpg",$im);//Path where converted image will be saved on localhost.
?>
<html>
<script>
function ok()
{
location.href='/Image/1.html';
}
</script>
<img src="/Image/Converted/a.jpg" height="900" width="600">
<input type=Button Value=Done onclick="ok()">
</html>
<?php
$im->clear();
$im->destroy();
}?>
HTML code. Insert your name of php file in the action tag.
<html>
<body>
<h1 align=center>Upload image</h1>
<form action=*.php method=POST enctype='multipart/form-data'>
Please select the file:<br>
<input type=file name=file><br>
<input type=SUBMIT value=Submit>
<input type=Reset value=Reset>
</form>
</body>