forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: roshanjameer on April 09, 2008, 04:09:56 pm

Title: converting the images from one type to another
Post by: roshanjameer on April 09, 2008, 04:09:56 pm
hi


i have add a link in the user menu to convert the images from one type to another(jpg to gif...).but the script is not working.it is not converting the images.any of your help will be surely appreciated.

thanks
mrjameer
Code: [Select]
<?php
session_start
();


define('IN_COPPERMINE'true);
define('SEARCH_PHP'true);

require(
'include/init.inc.php');

$myusername=$_SESSION['myusername'];

if (!
USER_ID && $CONFIG['allow_unlogged_access'] == 0) {
    
$redirect $redirect "login.php";
    
header("Location: $redirect");
    exit();
}

pageheader($convert_image['title']);
echo <<< EOT

<form name="frm" method="post" action="">
EOT;

starttable('60%'$convert_image['title']);
if(isset(
$_POST['submit']))
{

$allfiles=$_POST['allfiles'];
$ourfile=$_POST['ourfile'];



$parts explode('.'$allfiles);

$filename1 $parts[0]; 


$convertedfile=$filename1.".".$ourfile;

$path="C:/ImageMagick-6.4.0-Q16/";
umask(000);  
$sys=shell_exec($path."convert $allfiles $convertedfile");

 

if(
$sys)
{
echo 
"successfully converted";
}
else
{
echo "not";
}
}
else
{






?>


        <tr>
            <td class="tableb" align="center" ><?php echo $myusername;?>
                </td></tr>
<tr>
            <td class="tableb" align="center" >
<table border="1" style="border-color:#2C2B2B"><tr>
<td align="center" style="border-color:#2C2B2B">Select The File You Want To Convert</td>
<td align="center" style="border-color:#2C2B2B">
<select name="allfiles">
<?php

$conn4=mysql_connect("localhost","root","root");
mysql_select_db("jamjamcpg");
$sql="SELECT filename FROM cpg14x_pictures WHERE owner_name='$myusername'";
$result=mysql_query($sql,$conn4) or die (mysql_error());
while($newarray=mysql_fetch_array($result))
{
$fname=$newarray['filename'];
echo "<option name=\"$fname\" value=\"$fname\">$fname</option>";
}
echo "</select>";
?>

</td></tr>
<tr>
<td align="center" style="border-color:#2C2B2B">In Which Type You Want To Convert</td>
<td align="center" style="border-color:#2C2B2B">
<select name="ourfile">
<option name="gif" value="gif">GIF</option>
<option name="jpg" value="jpg">JPG</option>
<option name="png" value="png">PNG</option>
<option name="bmp" value="bmp">BMP</option>
<option name="psd" value="psd">PSD</option>
<option name="pcx" value="pcx">PCX</option>
<option name="tga" value="tga">TGA</option>
<option name="tiff" value="tiff">TIFF</option>
<option name="ico" value="ico">ICO</option>
<option name="pgm" value="pgm">PGM</option>
<option name="emz" value="emz">EMZ</option>
<option name="pcd" value="pcd">PCD</option>
</select>
</td></tr>
<tr><td align="center" style="border-color:#2C2B2B" colspan="2">
<input type="submit" name="submit" value="Submit"></td></tr>
</table>
            </td>
        </tr><tr><td bgcolor="454444">&nbsp;</td></tr>
             
                                </table>
                        </td>

</tr>
<?php
endtable
();
echo 
'</form>';
}
pagefooter();
ob_end_flush();
?>