|
|
|
รบกวนข่วยดูให้ทีครับ อยู่ดีๆ ckeditor ก็ไม่ขึ้นกลับโชว์เป็น textbox ธรรมดาแทน |
|
|
|
|
|
|
|
ขอดู Code หน่อยครับ
|
|
|
|
|
Date :
2013-07-30 17:04:22 |
By :
Patiya |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?
if($_POST[action]=="save"){
$fileupload=$_FILES['fileupload']['tmp_name'];
$fileupload_name=$_FILES['fileupload']['name'];
$fileupload_size=$_FILES['fileupload']['size'];
$fileupload_type=$_FILES['fileupload']['type'];
//check data//
if($_POST[name_th]=="" or $_POST[detail_th]=="" or $_POST[name_eng]=="" or $_POST[detail_eng]=="" ){
echo "<script>alert('กรุณาใส่ข้อมูลให้ครบ');history.back();</script>";
exit();
}
if($fileupload_size>"200000"){
echo "<script>alert('รูปภาพมีขนาดเกิน200kb');history.back();</script>";
exit();
}
//end check//
//insert data//
$data = array(
"name_th"=>addslashes($_POST[name_th]),
"name_eng"=>addslashes($_POST[name_eng]),
"detail_th"=>addslashes($_POST[detail_th]),
"detail_eng"=>addslashes($_POST[detail_eng]),
"date_post"=>date("d-m-y")
);
insert("sp_title",$data);
//end insert//
//upload picture//
if ($fileupload) {
$array_last=explode(".",$fileupload_name);
$c=count($array_last)-1;
$lastname=strtolower($array_last[$c]) ;
if ($lastname=="gif" or $lastname=="jpg" or $lastname=="jpeg") {
$sql="select max(id_title) from sp_title ";
$row = mysql_fetch_row(mysql_query($sql));
$photoname=date("Y-m-d-H-i-s")."_".$row[0].".".$lastname;
}
$ext = strtolower(end(explode('.', $fileupload_name)));
if ($ext == "jpg" or $ext == "jpeg" or $ext =="png" or $ext=="gif") {
if ($ext =="jpg" or $ext =="jpeg") {
$ori_img = imagecreatefromjpeg($fileupload);
} else if ($ext =="png") {
$ori_img = imagecreatefrompng($fileupload);
} else if ($ext =="gif") {
$ori_img = imagecreatefromgif($fileupload);
}
$ori_size = getimagesize($fileupload);
$ori_w = $ori_size[0];
$ori_h = $ori_size[1];
if ($ori_w>=$ori_h and $ori_w >350) {
$new_w = 350;
$new_h = round(($new_w/$ori_w) * $ori_h);
$new_img= imagecreatetruecolor($new_w, $new_h);
imagecopyresized( $new_img, $ori_img,0,0,0,0,$new_w, $new_h,$ori_w,$ori_h);
if ($ext =="jpg" or $ext =="jpeg") {
imagejpeg($new_img,"../images/title/".$photoname);
} else if ($ext =="png") {
imagepng($new_img,"../images/title/".$photoname);
} else if ($ext =="gif") {
imagegif($new_img,"../images/title/".$photoname);
}
imagedestroy($ori_img);
imagedestroy($new_img);
} else if ($ori_h>=$ori_h and $ori_h >200) {
$new_h = 200;
$new_w = round(($new_h/$ori_h) * $ori_w);
$new_img= imagecreatetruecolor($new_w, $new_h);
imagecopyresized( $new_img, $ori_img,0,0,0,0,$new_w, $new_h,$ori_w,$ori_h);
if ($ext =="jpg" or $ext =="jpeg") {
imagejpeg($new_img,"../images/title/".$photoname);
} else if ($ext =="png") {
imagepng($new_img,"../images/title/".$photoname);
} else if ($ext =="gif") {
imagegif($new_img,"../images/title/".$photoname);
}
imagedestroy($ori_img);
imagedestroy($new_img);
}else{
copy($fileupload,"../images/title/".$photoname);
}
}//end if($ext==jpg)//
$data = array(
"image"=>($photoname),
);
update("sp_title",$data,"id_title='$row[0]'");
unlink($fileupload);
}//end if($fileupload)//
//end upload//
unset($_POST[action]);
?>
<SCRIPT LANGUAGE="JavaScript">alert("add content suscessfully");window.location='main_index.php?mode=title_list.php';</script>
<?
}//end $_POST[action]//
?>
<!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=utf-8" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style>
td{
padding:5px;
}
</style>
</head>
<body>
<h2 align="center">เพิ่ม Story</h2>
<form action="main_index.php?mode=title_add.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="700" border="0" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
<tr>
<td align="center">ชื่อ Story thai</td>
<td align="left"><input name="name_th" type="text" id="name_th" size="60" /></td>
</tr>
<tr>
<td align="center">ชื่อ Story eng</td>
<td align="left"><label>
<input name="name_eng" type="text" id="name_eng" size="60" />
</label></td>
</tr>
<tr>
<td align="center" valign="top">รายละเอียด thai</td>
<td align="left"><label>
<textarea name="detail_th" id="detail_th" cols="45" rows="5"></textarea>
</label>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'detail_th',{
toolbar :
[
['NewPage','Preview','-'],
['PasteFromWord'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink'],['Image','Table','HorizontalRule'],
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],['Maximize', 'ShowBlocks']
],
height : 200,
width : 500,
language : 'th',
} );
//]]>
</script></td>
</tr>
<tr>
<td align="center" valign="top">รายละเอียด eng</td>
<td align="left"><label>
<textarea name="detail_eng" id="detail_eng" cols="45" rows="5"></textarea>
</label>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'detail_eng',{
toolbar :
[
['NewPage','Preview','-'],
['PasteFromWord'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink'],['Image','Table','HorizontalRule'],
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],['Maximize', 'ShowBlocks']
],
height : 200,
width : 500,
language : 'en',
} );
//]]>
</script> </td>
</tr>
<tr>
<td align="center">รูปภาพ </td>
<td align="left"><label>
<input name="fileupload" type="file" id="fileupload" />
ขนาด 360px*300px</label></td>
</tr>
<tr>
<td colspan="2" align="center"><label>
<input type="reset" name="button2" id="button2" value="Reset" />
</label>
<label>
<input type="submit" name="button" id="button" value="Submit" />
<input name="action" type="hidden" id="action" value="save" />
</label></td>
</tr>
</table>
</form>
</body>
</html>
นี่เลยครับ
|
|
|
|
|
Date :
2013-07-30 17:06:53 |
By :
golden014 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
java script รันได้ปกติหรือเปล่า
|
|
|
|
|
Date :
2013-07-30 18:29:38 |
By :
iieszz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|