Assalam-o-alaikum
Bothers main nay aik dynamic website create ki hay. us main sub kuch theik ja reha hay. Products feed karain to error atta hay.
Fatal error: Call to undefined function imagecreatefromjpeg() in /home/ctcenter/public_html/cp/add_prds_done.php on line 117
(FILE IS ATTACHED UNDER)
Thanks in advance for help
Almuez
<?php
include_once("../config.inc.php");
include_once("login_buffer.php");
include("config.php");
$id = $_REQUEST['id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>:* Welcome to LELIJA-WAERS, ADMIN PANEL: *</title>
<link href="file:///J|/Ticket/lelijawears1/cp/style.css" rel="stylesheet" type="text/css" />
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" class="bg_color">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="784" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><? include_once("headr.php"); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="784" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="cp/images/win_top.jpg" width="784" height="16" /></td>
</tr>
<tr>
<td background="file:///J|/Ticket/lelijawears1/cp/im...bg.jpg"><table style="width: 784px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="13"><img src="cp/images/navigation_left.jpg" width="13" height="31" /></td>
<td><? include_once("nav.php"); ?></td>
<td width="13" align="right"><img src="cp/images/navigation_right.jpg" width="13" height="31" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10" align="center"></td>
</tr>
<tr>
<td align="center"><img src="cp/images/banner.jpg" width="752" height="85" /></td>
</tr>
<tr>
<td align="center"><table width="752" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="29%" valign="top"><? include_once("menu.html"); ?></td>
<td align="center" valign="top"><table width="510" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="cp/images/pro_win_top.jpg" width="540" height="8" /></td>
</tr>
<tr>
<td bgcolor="#F3F3F3"><table width="530" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="530" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="8"><img src="cp/images/b_hea_l.jpg" width="8" height="25" /></td>
<td width="514" background="cp/images/b_hea_bg.jpg"> </td>
<td width="8" align="right"><img src="cp/images/b_hea_r.jpg" width="8" height="25" /></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="400" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="7"><img src="cp/images/bl_head_l.jpg" width="7" height="22" /></td>
<td width="513" align="left" background="cp/images/bl_head_bg.jpg" class="heading_txt">Product Updated </td>
<td width="6" align="right"><img src="cp/images/bl_head_r.jpg" width="7" height="22" /></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left"> </td>
</tr>
<tr>
<td align="left" class="menu_txt"><? if (isset($_REQUEST['upForm'])){
$file_type = $_FILES['imgfile']['type'];
$file_name =time().$_FILES['imgfile']['name'];
$file_size = $_FILES['imgfile']['size'];
$file_tmp = $_FILES['imgfile']['tmp_name'];
//check if you have selected a file.
if(!is_uploaded_file($file_tmp)){
echo "Error: Please select a file to upload!. <br>--<a href=\"javascript:history.go(-1)\"><img src=\"images/back.jpg\" border=\"0\"/></a>";
exit(); //exit the script and don't do anything else.
}
//check file extension
$ext = strrchr($file_name,'.');
$ext = strtolower($ext);
if (($extlimit == "yes") && (!in_array($ext,$limitedext))) {
echo "Wrong file extension. <br>--<a href=\"javascript:history.go(-1)\"><img src=\"images/back.jpg\" border=\"0\"/></a>";
exit();
}
//get the file extension.
$getExt = explode ('.', $file_name);
$file_ext = $getExt[count($getExt)-1];
//create a random file name
$rand_name = md5(time());
$rand_name= rand(0,999999999);
//get the new width variable.
$ThumbWidth = $img_thumb_width;
//keep image type
if($file_size){
if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){
$new_img = imagecreatefromjpeg($file_tmp);
}elseif($file_type == "image/x-png" || $file_type == "image/png"){
$new_img = imagecreatefrompng($file_tmp);
}elseif($file_type == "image/gif"){
$new_img = imagecreatefromgif($file_tmp);
}
//list width and height and keep height ratio.
list($width, $height) = getimagesize($file_tmp);
$imgratio=$width/$height;
if ($imgratio>1){
$newwidth = $ThumbWidth;
$newheight = $ThumbWidth/$imgratio;
}else{
$newheight = $ThumbWidth;
$newwidth = $ThumbWidth*$imgratio;
}
//function for resize image.
if (function_exists(imagecreatetruecolor)){
$resized_img = imagecreatetruecolor($newwidth,$newheight);
}else{
die("Error: Please make sure you have GD library ver 2+");
}
imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
//save image
ImageJpeg ($resized_img,"$path_thumbs/100_$rand_name.$file_ext",100);
ImageDestroy ($resized_img);
ImageDestroy ($new_img);
//print message
// echo "<br>Image Thumb: <a href=\"$path_thumbs/$rand_name.$file_ext\">$path_thumbs/$rand_name.$file_ext</a>";
}
//upload the big image
move_uploaded_file ($file_tmp, "$path_big/$rand_name.$file_ext");
echo "Product Added Successfully";
// echo "<br><br>--<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}else{ //if the form hasn't been submitted.
//print the form
}
$prds_name = $_REQUEST['prds_name'];
//$prds_name_fr = $_REQUEST['prds_name_fr'];
//$prds_name_de = $_REQUEST['prds_name_de'];
$art_no = $_REQUEST['art_no'];
//$art_no_fr = $_REQUEST['art_no_fr'];
//$art_no_de = $_REQUEST['art_no_de'];
$color = $_REQUEST['color'];
//$colors = $_REQUEST['colors'];
//$colors = $_REQUEST['colors'];
$sizes = $_REQUEST['size'];
//$sizes_fr = $_REQUEST['size_fr'];
//$sizes_de = $_REQUEST['size_de'];
$description = $_REQUEST['description'];
//$description_fr = $_REQUEST['description_fr'];
//$description_de = $_REQUEST['description_de'];
$special_prd = $_REQUEST['special_prd'];
if($result = mysql_query("select * from products where sub_cat_id = '$id' order by sorting_order desc"))
{
if($row = mysql_fetch_array($result))
{
$sorting=$row['sorting_order']-1;
}
else
{
$sorting=1;
}
}
$prds_rs = mysql_query("INSERT INTO products(sub_cat_id ,prds_name,art_no,color,description,size,sp_prd,li mg,simg,sorting_order) VALUES('$id', '$prds_name','$art_no','$color','$description','$s izes','$special_prd','$rand_name.$file_ext','100_$ rand_name.$file_ext', '0')") or die(mysql_error());
//$msg = "Product Added Successfully";
//}else{
//$msg = "Error Uploading Image";
//}
?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left" class="nav_txt"><a href="javascript:history.go(-1)"><img src="cp/images/back.jpg" width="87" height="24" border="0" /></a></td>
</tr>
</table>
<p> </p>
</td>
</tr>
<tr>
<td><img src="cp/images/pro_win_botom.jpg" width="540" height="8" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="cp/images/win_botom.jpg" width="784" height="16" /></td>
</tr>
</table> </td>
</tr>
<tr>
<td class="botom_bg"><table width="784" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
<tr>
<td><? include_once("bottom.html"); ?></td>
</tr>
<tr>
<td align="center"><table width="784" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txt"> </td>
<td align="center" class="txt"> </td>
<td width="240" rowspan="2" align="right" class="txt"><table width="148" height="14" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="83">Powered By : </td>
<td width="65"><img src="cp/images/copyright_logo.jpg" width="55" height="47" /></td>
</tr>
</table></td>
</tr>
<tr>
<td width="250" class="txt"> </td>
<td width="294" align="center" class="txt">Copy Rights 2008 - All Rights Reserved </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
Bothers main nay aik dynamic website create ki hay. us main sub kuch theik ja reha hay. Products feed karain to error atta hay.
Fatal error: Call to undefined function imagecreatefromjpeg() in /home/ctcenter/public_html/cp/add_prds_done.php on line 117
(FILE IS ATTACHED UNDER)
Thanks in advance for help
Almuez
<?php
include_once("../config.inc.php");
include_once("login_buffer.php");
include("config.php");
$id = $_REQUEST['id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>:* Welcome to LELIJA-WAERS, ADMIN PANEL: *</title>
<link href="file:///J|/Ticket/lelijawears1/cp/style.css" rel="stylesheet" type="text/css" />
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" class="bg_color">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="784" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><? include_once("headr.php"); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="784" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="cp/images/win_top.jpg" width="784" height="16" /></td>
</tr>
<tr>
<td background="file:///J|/Ticket/lelijawears1/cp/im...bg.jpg"><table style="width: 784px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="13"><img src="cp/images/navigation_left.jpg" width="13" height="31" /></td>
<td><? include_once("nav.php"); ?></td>
<td width="13" align="right"><img src="cp/images/navigation_right.jpg" width="13" height="31" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10" align="center"></td>
</tr>
<tr>
<td align="center"><img src="cp/images/banner.jpg" width="752" height="85" /></td>
</tr>
<tr>
<td align="center"><table width="752" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="29%" valign="top"><? include_once("menu.html"); ?></td>
<td align="center" valign="top"><table width="510" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="cp/images/pro_win_top.jpg" width="540" height="8" /></td>
</tr>
<tr>
<td bgcolor="#F3F3F3"><table width="530" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="530" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="8"><img src="cp/images/b_hea_l.jpg" width="8" height="25" /></td>
<td width="514" background="cp/images/b_hea_bg.jpg"> </td>
<td width="8" align="right"><img src="cp/images/b_hea_r.jpg" width="8" height="25" /></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="400" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="7"><img src="cp/images/bl_head_l.jpg" width="7" height="22" /></td>
<td width="513" align="left" background="cp/images/bl_head_bg.jpg" class="heading_txt">Product Updated </td>
<td width="6" align="right"><img src="cp/images/bl_head_r.jpg" width="7" height="22" /></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left"> </td>
</tr>
<tr>
<td align="left" class="menu_txt"><? if (isset($_REQUEST['upForm'])){
$file_type = $_FILES['imgfile']['type'];
$file_name =time().$_FILES['imgfile']['name'];
$file_size = $_FILES['imgfile']['size'];
$file_tmp = $_FILES['imgfile']['tmp_name'];
//check if you have selected a file.
if(!is_uploaded_file($file_tmp)){
echo "Error: Please select a file to upload!. <br>--<a href=\"javascript:history.go(-1)\"><img src=\"images/back.jpg\" border=\"0\"/></a>";
exit(); //exit the script and don't do anything else.
}
//check file extension
$ext = strrchr($file_name,'.');
$ext = strtolower($ext);
if (($extlimit == "yes") && (!in_array($ext,$limitedext))) {
echo "Wrong file extension. <br>--<a href=\"javascript:history.go(-1)\"><img src=\"images/back.jpg\" border=\"0\"/></a>";
exit();
}
//get the file extension.
$getExt = explode ('.', $file_name);
$file_ext = $getExt[count($getExt)-1];
//create a random file name
$rand_name = md5(time());
$rand_name= rand(0,999999999);
//get the new width variable.
$ThumbWidth = $img_thumb_width;
//keep image type
if($file_size){
if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){
$new_img = imagecreatefromjpeg($file_tmp);
}elseif($file_type == "image/x-png" || $file_type == "image/png"){
$new_img = imagecreatefrompng($file_tmp);
}elseif($file_type == "image/gif"){
$new_img = imagecreatefromgif($file_tmp);
}
//list width and height and keep height ratio.
list($width, $height) = getimagesize($file_tmp);
$imgratio=$width/$height;
if ($imgratio>1){
$newwidth = $ThumbWidth;
$newheight = $ThumbWidth/$imgratio;
}else{
$newheight = $ThumbWidth;
$newwidth = $ThumbWidth*$imgratio;
}
//function for resize image.
if (function_exists(imagecreatetruecolor)){
$resized_img = imagecreatetruecolor($newwidth,$newheight);
}else{
die("Error: Please make sure you have GD library ver 2+");
}
imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
//save image
ImageJpeg ($resized_img,"$path_thumbs/100_$rand_name.$file_ext",100);
ImageDestroy ($resized_img);
ImageDestroy ($new_img);
//print message
// echo "<br>Image Thumb: <a href=\"$path_thumbs/$rand_name.$file_ext\">$path_thumbs/$rand_name.$file_ext</a>";
}
//upload the big image
move_uploaded_file ($file_tmp, "$path_big/$rand_name.$file_ext");
echo "Product Added Successfully";
// echo "<br><br>--<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}else{ //if the form hasn't been submitted.
//print the form
}
$prds_name = $_REQUEST['prds_name'];
//$prds_name_fr = $_REQUEST['prds_name_fr'];
//$prds_name_de = $_REQUEST['prds_name_de'];
$art_no = $_REQUEST['art_no'];
//$art_no_fr = $_REQUEST['art_no_fr'];
//$art_no_de = $_REQUEST['art_no_de'];
$color = $_REQUEST['color'];
//$colors = $_REQUEST['colors'];
//$colors = $_REQUEST['colors'];
$sizes = $_REQUEST['size'];
//$sizes_fr = $_REQUEST['size_fr'];
//$sizes_de = $_REQUEST['size_de'];
$description = $_REQUEST['description'];
//$description_fr = $_REQUEST['description_fr'];
//$description_de = $_REQUEST['description_de'];
$special_prd = $_REQUEST['special_prd'];
if($result = mysql_query("select * from products where sub_cat_id = '$id' order by sorting_order desc"))
{
if($row = mysql_fetch_array($result))
{
$sorting=$row['sorting_order']-1;
}
else
{
$sorting=1;
}
}
$prds_rs = mysql_query("INSERT INTO products(sub_cat_id ,prds_name,art_no,color,description,size,sp_prd,li mg,simg,sorting_order) VALUES('$id', '$prds_name','$art_no','$color','$description','$s izes','$special_prd','$rand_name.$file_ext','100_$ rand_name.$file_ext', '0')") or die(mysql_error());
//$msg = "Product Added Successfully";
//}else{
//$msg = "Error Uploading Image";
//}
?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="left" class="nav_txt"><a href="javascript:history.go(-1)"><img src="cp/images/back.jpg" width="87" height="24" border="0" /></a></td>
</tr>
</table>
<p> </p>
</td>
</tr>
<tr>
<td><img src="cp/images/pro_win_botom.jpg" width="540" height="8" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="cp/images/win_botom.jpg" width="784" height="16" /></td>
</tr>
</table> </td>
</tr>
<tr>
<td class="botom_bg"><table width="784" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
<tr>
<td><? include_once("bottom.html"); ?></td>
</tr>
<tr>
<td align="center"><table width="784" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="txt"> </td>
<td align="center" class="txt"> </td>
<td width="240" rowspan="2" align="right" class="txt"><table width="148" height="14" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="83">Powered By : </td>
<td width="65"><img src="cp/images/copyright_logo.jpg" width="55" height="47" /></td>
</tr>
</table></td>
</tr>
<tr>
<td width="250" class="txt"> </td>
<td width="294" align="center" class="txt">Copy Rights 2008 - All Rights Reserved </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
Comment