發表文章

目前顯示的是 4月, 2015的文章

[PHP] getimagesize,ckeditor大小設定

ckeditor的編輯器大小可以在config.js設定 config.width = '100%'; 要來判定上傳的是不是圖片可以使用  getimagesize  這個function 當上傳的並非是圖片時會  return false  上傳成功後會回傳一個array index 0 : 圖片width index 1 : 圖片height 剩下的請參考 官方manual 附上ckeditor內上傳圖片相關code 首先必須將text area的id給取得,之後再該text area上蓋一層div $(document).ready(function(){ CKEDITOR.replace('Store_Info', { filebrowserImageUploadUrl: '上傳圖片的php-code'}); for (var i in CKEDITOR.instances) { CKEDITOR.instances[i].on('focus', function() { if (!is_beforeunload) { is_beforeunload = true; $(window).bind('beforeunload', function (e) { return '資料尚未存檔,確定是否要離開?'; }); } }); } }); 其中Store_Info為textarea的id filebrowserImageUploadUrl則是server-side code處理上傳圖片用 /* * 新增供應商詳細說明圖片的上傳controller * */ public function upload_supplier_detail_pic(){ // ckeditor回傳的參數 $CKEditorFuncNum = $this->input->get('CKEditorFuncNum', true); // 檔案存放路徑 $file_path = I_DOC."/store_supplie

[PHP] 防止網頁cache

資料來源 : http://boray06.blogspot.tw/2010/11/php-cache-no-cache.html //php code // Always modified header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); // HTTP/1.1 header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("Pragma: no-cache");