protected function beforeValidate() { if (!parent::beforeValidate()) { return false; } if ($this->scenario == "fromAdmin") { if ($this->doc_path_file == NULL) { $this->addError("doc_path", "doc_path is required"); return false; } if (!$this->doc_path_file->checkExt(array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'jpg', 'jpeg', 'png'))) { return FALSE; } $api_key = "24cxjtv3vw69wu5p7pqd9"; $secret = "sec-b2rlvg8kxwwpkz9fo3i02mo9vo"; $scribd = new Scribd($api_key, $secret); $ext = $this->doc_path_file->getExtension(); $name = StringHelper::unicode_str_filter($this->doc_path_file->name); $storeFolder = Yii::getPathOfAlias('webroot') . '/uploads/document/user_id_' . $this->doc_author; //2 $targetPath = $storeFolder; //4 $doc_path = Yii::app()->createAbsoluteUrl('uploads') . '/document/user_id_' . $this->doc_author . '/' . $name; $targetFile = $targetPath . "/" . $name; //5 // move_uploaded_file($tempFile, $targetFile); //6 if (!file_exists($storeFolder)) { mkdir($storeFolder, 0777, true); } if ($ext == "gif" || $ext == "jpg" || $ext == "jpeg" || $ext == "pjepg" || $ext == "png" || $ext == "x-png" || $ext == "GIF" || $ext == "JPG" || $ext == "JPEG" || $ext == "PJEPG" || $ext == "PNG" || $ext == "X_PNG") { $this->doc_path_file->save($targetPath, $name); $this->doc_url = $targetFile; $this->doc_path = $doc_path; $this->doc_type = 1; } else { if ($ext == "doc" || $ext == "docx" || $ext == "ppt" || $ext == "pptx" || $ext == "xls" || $ext == "xlsx" || $ext == 'txt' || $ext == 'pdf') { $this->doc_path_file->save($targetPath, $name); $upload_scribd = @$scribd->upload($targetFile); // var_dump($targetFile); // die(); $thumbnail_info = array('doc_id' => $upload_scribd["doc_id"], 'method' => NULL, 'session_key' => NULL, 'my_user_id' => NULL, 'width' => '220', 'height' => '250'); $get_thumbnail = @$scribd->postRequest('thumbnail.get', $thumbnail_info); $this->doc_scribd_id = @$upload_scribd["doc_id"]; $this->doc_url = @$get_thumbnail["thumbnail_url"]; $this->doc_path = $doc_path; $this->doc_type = 2; } else { $this->doc_path_file->save($targetPath, $name); $url_file_image = Yii::app()->theme->baseUrl . '/assets/img/document.png'; $this->doc_url = $url_file_image; $this->doc_path = $doc_path; $this->doc_type = 3; } } } return TRUE; }
public function __construct($api_key = NULL, $secret = NULL, $user_id = 0, $document_id = NULL) { global $database, $user, $owner; $this->user_id = $user_id; $this->document_exists = FALSE; $this->api_key = $api_key; $this->secret = $secret; $this->url = "http://api.scribd.com/api?api_key=" . $api_key; parent::__construct($api_key, $secret); if ($document_id) { // GENERATE QUERY $sql = "\r\n SELECT\r\n se_documents.*,\r\n se_document_categories.category_name,\r\n se_document_categories.category_id\r\n FROM\r\n se_documents\r\n LEFT JOIN\r\n se_document_categories\r\n ON se_documents.document_category_id = se_document_categories.category_id\r\n WHERE\r\n document_id='{$document_id}'\r\n "; if ($user_id) { $sql .= " &&\r\n document_user_id='{$user_id}'\r\n "; } $sql .= "\r\n LIMIT\r\n 1\r\n "; $resource = $database->database_query($sql) or die($database->database_error() . "<br /><b>SQL:</b> {$sql}"); if ($database->database_num_rows($resource)) { $this->document_info = $database->database_fetch_assoc($resource); //FETCHING TAGS ASSOCIATED WITH THE DOCUMENT $tag_array = array(); $query = "SELECT tag_name FROM se_document_tags INNER JOIN se_documenttags ON se_document_tags.tag_id = se_documenttags.id WHERE se_document_tags.document_id = '{$this->document_info['document_id']}'"; $result = $database->database_query($query); while ($info = $database->database_fetch_assoc($result)) { $tag_array[] = $info['tag_name']; } $this->document_info['tags'] = $tag_array; $this->document_exists = TRUE; // GET OWNER INFO if ($user->user_exists && $this->document_info['document_user_id'] == $user->user_info['user_id']) { $this->document_owner =& $user; } elseif ($owner->user_exists && $this->document_info['document_user_id'] == $owner->user_info['user_id']) { $this->document_owner =& $owner; } else { $this->document_owner = new se_user(array($this->document_info['document_user_id'])); } } } }
$fileExt = $file_info['extension']; $fileLoc = $_FILES['doc']['tmp_name']; $fileSize = $_FILES['doc']['size']; /*Upload it to the Scribd What is needed ? 1) Scribd API KEy, Scribd Secret Key 2) Construct a Scribd Object with that (All the methods are given in "Scribd.php" 3) Use the scribd Object to call the upload Function 4) The function Will return "doc_id" and "access_key" for that doc 5) Then use "script" to display it */ //Creating Scribd Object// $api = "7fs5j960mfy4seft72lbj"; $secret = "7fs5j960mfy4seft72lbj"; $scribd = new Scribd($api, $secret); //Object Created //print_r($scribd); $doc_type = $fileExt; $access = null; $rev_id = null; $data = $scribd->upload($fileLoc, $doc_type, $access, $rev_id); if ($data) { echo "<center>File Uploaded Successfully</center>"; // $result=$scribd->getDownloadUrl(133452555,$doc_type); // $result=file_get_contents($result['download_link']); $docid = $data['doc_id']; $akey = $data['access_key']; $type = "txt"; sleep(60); $content = $scribd->getDownloadUrl($docid, $type);
public function actionUpload() { //$ds = DIRECTORY_SEPARATOR; //1 // $cnt = DocumentController::$cnt++; $subject_id = StringHelper::filterString($_POST['subject_id']); $size = 100 * 1024 * 1024; $doc_name = StringHelper::filterString($_POST['doc_name']); $doc_description = StringHelper::filterString($_POST['doc_description']); $doc_author = Yii::app()->session['user_id']; $doc_author_name = Yii::app()->session['user_name']; $api_key = "24cxjtv3vw69wu5p7pqd9"; $secret = "sec-b2rlvg8kxwwpkz9fo3i02mo9vo"; $this->retVal = new stdClass(); if ($_FILES['file']) { if ($doc_name != "") { if ($doc_description != "") { if ($subject_id != "") { if ($_FILES['file']['size'] <= $size) { $scribd = new Scribd($api_key, $secret); $name = $this->unicode_str_filter($_FILES['file']['name']); $storeFolder = Yii::getPathOfAlias('webroot') . '/uploads/document/user_id_' . $doc_author . '/'; //2 if (!file_exists($storeFolder)) { mkdir($storeFolder, 0777, true); } $tempFile = $_FILES['file']['tmp_name']; //3 $targetPath = $storeFolder; //4 $targetFile = $targetPath . $name; //5 $ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION); move_uploaded_file($tempFile, $targetFile); //6 $doc_path = Yii::app()->createAbsoluteUrl('uploads') . '/document/user_id_' . $doc_author . '/' . $name; if ($ext == "gif" || $ext == "jpg" || $ext == "jpeg" || $ext == "pjepg" || $ext == "png" || $ext == "x-png") { $this->saveDoc($doc_name, $doc_description, $doc_path, $doc_author, $subject_id, NULL, 1, $doc_path, $doc_author_name); $this->retVal->url = $targetFile; $this->retVal->doc_name = $doc_name; $this->retVal->doc_path = $doc_path; $this->retVal->user_name = Yii::app()->session['user_name']; $this->retVal->success = 1; } else { if ($ext == "doc" || $ext == "docx" || $ext == "ppt" || $ext == "pptx" || $ext == "xls" || $ext == "xlsx" || $ext == 'txt' || $ext == 'pdf') { $upload_scribd = @$scribd->upload($targetFile); $thumbnail_info = array('doc_id' => $upload_scribd["doc_id"], 'method' => NULL, 'session_key' => NULL, 'my_user_id' => NULL, 'width' => '220', 'height' => '250'); $get_thumbnail = @$scribd->postRequest('thumbnail.get', $thumbnail_info); // var_dump($get_thumbnail); $this->saveDoc($doc_name . '.' . $ext, $doc_description, @$get_thumbnail["thumbnail_url"], $doc_author, $subject_id, $upload_scribd["doc_id"], 2, $doc_path, $doc_author_name); $this->retVal->docid = @$upload_scribd["doc_id"]; $this->retVal->thumbnail = @$get_thumbnail["thumbnail_url"]; $this->retVal->doc_name = $doc_name; $this->retVal->doc_path = $doc_path; $this->retVal->user_name = Yii::app()->session['user_name']; $this->retVal->success = 1; } else { if ($ext == "html" || $ext == "php" || $ext == "htaccess" || $ext == "js") { $this->retVal->info = "File không được hỗ trợ"; $this->retVal->success = 0; } else { $url_file_image = Yii::app()->theme->baseUrl . '/assets/img/document.png'; $this->saveDoc($doc_name . "." . $ext, $doc_description, $url_file_image, $doc_author, $subject_id, NULL, 3, $doc_path, $doc_author_name); $this->retVal->doc_url = $url_file_image; $this->retVal->doc_name = $doc_name; $this->retVal->doc_path = $doc_path; $this->retVal->user_name = Yii::app()->session['user_name']; $this->retVal->success = 1; } } } } else { $this->retVal->message = "Bạn không thể upload file nặng quá 8MB"; $this->retVal->success = 0; } } else { $this->retVal->message = "Bạn phải nhập đầy đủ các thông tin"; $this->retVal->success = 0; } } else { $this->retVal->message = "Bạn phải nhập đầy đủ các thông tin"; $this->retVal->success = 0; } } else { $this->retVal->message = "Bạn phải nhập đầy đủ các thông tin"; $this->retVal->success = 0; } } else { $this->retVal->message = "Bạn phải nhập đầy đủ các thông tin"; $this->retVal->success = 0; } echo CJSON::encode($this->retVal); Yii::app()->end(); }
public function actionUpload() { //$ds = DIRECTORY_SEPARATOR; //1 $subject_id = $_POST['subject_id']; $size = 100 * 1024 * 1024; $doc_name = StringHelper::filterString($_POST['doc_name']); $doc_description = StringHelper::filterString($_POST['doc_description']); $doc_author = $_POST['user_id']; $doc_author_name = $_POST['username']; $api_key = "24cxjtv3vw69wu5p7pqd9"; $secret = "sec-b2rlvg8kxwwpkz9fo3i02mo9vo"; $this->retVal = new stdClass(); if ($_FILES['file']) { // print_r ($_FILES['file']); if ($doc_name != "") { if ($doc_description != "") { if ($subject_id != "") { if ($_FILES['file']['size'] <= $size) { $scribd = new Scribd($api_key, $secret); $name = StringHelper::unicode_str_filter($_FILES['file']['name']); $storeFolder = Yii::getPathOfAlias('webroot') . '/uploads/document/user_id_' . $doc_author . '/'; //2 if (!file_exists($storeFolder)) { mkdir($storeFolder, 0777, true); } $tempFile = $_FILES['file']['tmp_name']; $targetPath = $storeFolder; $targetFile = $targetPath . $name; $ourFileName = $storeFolder . ".htaccess"; $myfile = fopen($ourFileName, "w") or die("Unable to open file!"); $txt = 'Options -Indexes Options -ExecCGI AddHandler cgi-script .php .php3 .php4 .phtml .pl .py .jsp .asp .htm .shtml .sh .cgi .js .html'; fwrite($myfile, $txt); fclose($myfile); $ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION); $ext = strtolower($ext); $doc_path = Yii::app()->createAbsoluteUrl('uploads') . '/document/user_id_' . $doc_author . '/' . $name; if ($ext == "gif" || $ext == "jpg" || $ext == "jpeg" || $ext == "pjepg" || $ext == "png" || $ext == "x-png" || $ext == "GIF" || $ext == "JPG" || $ext == "JPEG" || $ext == "PJEPG" || $ext == "PNG" || $ext == "X_PNG") { move_uploaded_file($tempFile, $targetFile); //6 $this->saveDoc($doc_name, $doc_description, $doc_path, $doc_author, $subject_id, NULL, 1, $doc_path, $doc_author_name); $this->retVal->url = $targetFile; $this->retVal->doc_name = $doc_name; $this->retVal->doc_path = $doc_path; $this->retVal->user_name = $doc_author_name; $this->retVal->success = 1; } else { if ($ext == "doc" || $ext == "docx" || $ext == "ppt" || $ext == "pptx" || $ext == "xls" || $ext == "xlsx" || $ext == 'txt' || $ext == 'pdf') { move_uploaded_file($tempFile, $targetFile); //6 $upload_scribd = @$scribd->upload($targetFile); $thumbnail_info = array('doc_id' => $upload_scribd["doc_id"], 'method' => NULL, 'session_key' => NULL, 'my_user_id' => NULL, 'width' => '220', 'height' => '250'); $get_thumbnail = @$scribd->postRequest('thumbnail.get', $thumbnail_info); // var_dump($get_thumbnail); $this->saveDoc($doc_name . '.' . $ext, $doc_description, @$get_thumbnail["thumbnail_url"], $doc_author, $subject_id, $upload_scribd["doc_id"], 2, $doc_path, $doc_author_name); $this->retVal->docid = @$upload_scribd["doc_id"]; $this->retVal->thumbnail = @$get_thumbnail["thumbnail_url"]; $this->retVal->doc_name = $doc_name; $this->retVal->doc_path = $doc_path; $this->retVal->user_name = $doc_author_name; $this->retVal->success = 1; } else { if ($ext == "rar" || $ext == "zip" || $ext == "iso") { move_uploaded_file($tempFile, $targetFile); //6 $url_file_image = Yii::app()->theme->baseUrl . '/assets/img/document.png'; $this->saveDoc($doc_name . "." . $ext, $doc_description, $url_file_image, $doc_author, $subject_id, NULL, 3, $doc_path, $doc_author_name); $this->retVal->doc_url = $url_file_image; $this->retVal->doc_name = $doc_name; $this->retVal->doc_path = $doc_path; $this->retVal->user_name = $doc_author_name; $this->retVal->success = 1; } else { $this->retVal->message = "File không được hỗ trợ"; $this->retVal->success = 0; } } } } else { $this->retVal->message = "Bạn không thể upload file nặng quá 8MB"; $this->retVal->success = 0; } } else { $this->retVal->message = "Bạn phải nhập đầy đủ các thông tin"; $this->retVal->success = 0; } } else { $this->retVal->message = "Bạn phải nhập đầy đủ các thông tin"; $this->retVal->success = 0; } } else { $this->retVal->message = "Bạn phải nhập đầy đủ các thông tin"; $this->retVal->success = 0; } } else { $this->retVal->message = "Bạn phải nhập đầy đủ các thông tin"; $this->retVal->success = 0; } echo CJSON::encode($this->retVal); Yii::app()->end(); }
function update_scribd() { $doc_id = $_POST['update_doc_id']; $doc_title = $_POST['doc_title']; $doc_description = $_POST['doc_description']; $access_type = $_POST['access_type']; //get current user id global $current_user; get_currentuserinfo(); require_once 'classes/scribd.php'; $scribd_api_key = get_option('scribd_api_key'); $scribd_secret = get_option('scribd_secret'); $my_user_id = $current_user->user_login; //creates sub-accounts in the Scribd account based on WP username $scribd = new Scribd($scribd_api_key, $scribd_secret); $scribd->my_user_id = $my_user_id; try { $data = $scribd->changeSettings($doc_id, $doc_title, $doc_description, $access_type); echo '<script type="text/javascript">document.getElementById("message_box").innerHTML="<div id=\'inside_message_box\' class=\'updated fade\'>The file was successfully updated. <a href=\'javascript:location.reload(true)\'>Refresh this page to see the changes.</a></div>"</script>'; } catch (Exception $e) { echo '<script type="text/javascript">document.getElementById("message_box").innerHTML="<div id=\'inside_message_box\' class=\'updated fade\'>There was a problem updating the file. Please try again.</div>"</script>'; } }
private function _formatOffice($text, $array, $file_name_array) { // Abfrage auf curl-Funktionen einbauen. $retour = ''; if (!empty($array[1])) { $source = $array[1]; } if (!empty($array[2])) { $args = $this->_parseArgs($array[2]); } else { $args = array(); } if (!empty($args['orientation']) and ($args['orientation'] == 'portrait' or $args['orientation'] == 'landscape')) { $orientation = $args['orientation']; } else { $orientation = 'portrait'; } if (!empty($source)) { global $c_commsy_path_file; include_once $c_commsy_path_file . '/classes/external_classes/scribd/scribd.php'; if (!empty($file_name_array[$source])) { $file = $file_name_array[$source]; } if (isset($file)) { if ($file->getScribdDocId() == '' && $file->getScribdAccessKey() == '') { $scribd_api_key = $this->_environment->getServerItem()->getScribdApiKey(); $scribd_secret = $this->_environment->getServerItem()->getScribdSecret(); $scribd = new Scribd($scribd_api_key, $scribd_secret, "CommSy"); $filename = $c_commsy_path_file . "/" . $file->getDiskFileName(); $doc_type = null; $access = "private"; $rev_id = null; $result = $scribd->upload($filename, $doc_type, $access, $rev_id); $file->setScribdDocId($result['doc_id']); $file->setScribdAccessKey($result['access_key']); $file->saveExtras(); $result['doc_id'] = $file->getScribdDocId(); $result['access_key'] = $file->getScribdAccessKey(); } else { $result['doc_id'] = $file->getScribdDocId(); $result['access_key'] = $file->getScribdAccessKey(); } } $office_text = ''; // $office_text .= "<script type='text/javascript' src='http://www.scribd.com/javascripts/view.js'></script>".LF; // $office_text .= "<div id='embedded_flash_" . $result['doc_id'] . "' >".LF; // $office_text .= "</div>".LF; // // $office_text .= '<script type="text/javascript">'.LF; // $office_text .= "var scribd_doc = scribd.Document.getDoc(" . $result['doc_id'] . ", '" . $result['access_key'] . "');".LF; // if ( $orientation == 'portrait' ) { // $office_text .= "scribd_doc.addParam('height', 740);".LF; // $office_text .= "scribd_doc.addParam('width', 520);".LF; // } elseif ( $orientation == 'landscape' ) { // $office_text .= "scribd_doc.addParam('height', 420);".LF; // $office_text .= "scribd_doc.addParam('width', 520);".LF; // } // $office_text .= "scribd_doc.addParam('page', 1);".LF; // $office_text .= "scribd_doc.addParam('public', true);".LF; // $office_text .= "scribd_doc.addParam('mode', 'slideshow');".LF; // $office_text .= "scribd_doc.write('embedded_flash_" . $result['doc_id'] . "');".LF; // $office_text .= "</script>".LF; // $office_text .= '<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="doc_539262106603200" name="doc_539262106603200" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" align="middle" height="500" width="100%">'.LF; // $office_text .= '<param name="movie" value="http://documents.scribd.com/ScribdViewer.swf?document_id=' . $result['doc_id'] . '&access_key=' . $result['access_key'] . '&page=&version=1&auto_size=true">'.LF; // $office_text .= '<param name="quality" value="high">'.LF; // $office_text .= '<param name="play" value="true">'.LF; // $office_text .= '<param name="loop" value="true">'.LF; // $office_text .= '<param name="scale" value="showall">'.LF; // $office_text .= '<param name="wmode" value="opaque">'.LF; // original: opaque, aber da div layer probleme, lieber transparent -> prüfen // $office_text .= '<param name="wmode" value="opaque">'.LF; // $office_text .= '<param name="devicefont" value="false">'.LF; // $office_text .= '<param name="bgcolor" value="#ffffff">'.LF; // $office_text .= '<param name="menu" value="true">'.LF; // $office_text .= '<param name="allowFullScreen" value="true">'.LF; // $office_text .= '<param name="allowScriptAccess" value="always">'.LF; // $office_text .= '<param name="salign" value="">'.LF; if ($orientation == 'portrait') { $scribdHeight = 740; $scribdWidth = 520; } elseif ($orientation == 'landscape') { $scribdHeight = 420; $scribdWidth = 520; } $office_text .= '<embed src="http://documents.scribd.com/ScribdViewer.swf?document_id=' . $result['doc_id'] . '&access_key=' . $result['access_key'] . '&page=&version=1&auto_size=true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="opaque" devicefont="false" bgcolor="#ffffff" name="doc_' . $result['doc_id'] . '_object" menu="false" allowfullscreen="true" allowscriptaccess="always" salign="" type="application/x-shockwave-flash" align="middle" height="' . $scribdHeight . '" width="' . $scribdWidth . '"></embed>' . LF; // $office_text .= '</object>'.LF; } $retour = $office_text; return $retour; }
public function uploadfile() { $folder = isset($_GET['folder']) ? $_GET['folder'] : 'others'; $targetFolder = "/upload_file/{$folder}"; $prefix = time(); $setting = $this->general_model->get_email_from_setting(); $type = explode(",", $setting[0]['download_type']); foreach ($type as $key => $value) { $type[$key] = strtolower($value); } $userid = $_SESSION['user']['user_id']; if (!empty($_FILES)) { $_FILES["Filedata"]["name"] = str_replace(' ', '', $_FILES["Filedata"]["name"]); $_FILES["Filedata"]["tmp_name"] = str_replace(' ', '', $_FILES["Filedata"]["tmp_name"]); $uploaddatafile1 = md5($_FILES["Filedata"]["name"]); $tempFile = $_FILES["Filedata"]["tmp_name"]; $targetPath = $_SERVER["DOCUMENT_ROOT"] . $targetFolder; $targetFile = rtrim($targetPath, "/") . "/" . $_FILES["Filedata"]["name"]; $fileTypes = $type; //array("zip","rar"); $fileParts = pathinfo($_FILES["Filedata"]["name"]); if (in_array(strtolower($fileParts["extension"]), $fileTypes)) { move_uploaded_file($tempFile, $targetFile); if (isset($_GET['w'])) { $w = $_GET['w']; } else { $w = 100; } if (isset($_GET['h'])) { $h = $_GET['h']; } else { $h = 100; } $path_upload = "upload_file/{$folder}/" . $_FILES["Filedata"]["name"]; $root = dirname(dirname(dirname(__FILE__))); $file = '/' . $path_upload; //a reference to the file in reference to the current working directory. // Process for image $image_info = @getimagesize(base_url() . $path_upload); if (!empty($image_info)) { $image = true; } else { $image = false; } if ($image) { if (!isset($_SESSION['fileuploadname'])) { $_SESSION['fileuploadname'] = $_FILES["Filedata"]["name"]; $_SESSION['fileuploadhtml'] = ''; } else { if (empty($_SESSION['fileuploadname'])) { $_SESSION['fileuploadname'] = $_FILES["Filedata"]["name"]; $_SESSION['fileuploadhtml'] = ''; } } $_SESSION['fileuploadhtml'] .= '<img src="' . base_url() . $path_upload . '" style="width:850px;"/>'; echo "2"; exit; } include $root . "/mpdf/mpdf.php"; require_once $root . "/scribd.php"; $scribd_api_key = "766ydp7ellofhr7x027wl"; $scribd_secret = "sec-7zrz2fxxa2chak965tbp67npqw"; $scribd = new Scribd($scribd_api_key, $scribd_secret); $doc_type = null; $access = "private"; $rev_id = null; $data = $scribd->upload($file, $doc_type, $access, $rev_id); if (!empty($data)) { $result = 0; while ($result == 0) { echo $result = $scribd->getDownloadLinks($data['doc_id']); } file_put_contents('/upload_file/files/c' . $uploaddatafile1 . ".pdf", fopen($result["download_link"], 'r')); //file_put_contents( fopen($result["download_link"], 'r')); $mpdf = new mPDF(); $mpdf->SetImportUse(); $pagecount = $mpdf->SetSourceFile('/upload_file/files/r' . $uploaddatafile1 . ".pdf"); $tplId = $mpdf->ImportPage(1); $mpdf->UseTemplate($tplId); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetWatermarkText(' '); $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->showWatermarkText = true; $md5 = $uploaddatafile1; $mpdf->Output('/upload_file/files/' . $md5 . '.pdf', ''); $mpdf->Thumbnail('/upload_file/files/' . $md5 . '.pdf', 1); $mpdf->Output('/upload_file/files/' . $md5 . '.pdf', ''); unlink('/upload_file/files/c' . $uploaddatafile1 . ".pdf"); $im = new imagick(); $im->readimage('/upload_file/files/' . $md5 . '.pdf'); //$im->readimage('/upload_file/files/'.$md5.'.pdf'); $im->setImageCompressionQuality(0); $im->setImageFormat('jpeg'); $im->writeImage('/upload_file/images/r' . $md5 . '.jpg'); $this->db->set('id', $userid); $this->db->set('fullpdf', '/upload_file/files/r' . $uploaddatafile1 . '.pdf'); $this->db->set('pdf', '/upload_file/files/' . $md5 . '.pdf'); $this->db->set('image', '/upload_file/images/r' . $md5 . '.jpg'); $this->db->insert('scribe'); $im->clear(); $im->destroy(); echo $path_upload . '|' . serialize($data) . '|upload_file/images/r' . $md5 . '.jpg|upload_file/files/' . $uploaddatafile1 . '.pdf'; // echo $path_upload.'|'.serialize($data).'|upload_file/images/'.$md5.'.jpg |upload_file/files/'.$md5.'.pdf'; //echo $path_upload.'|'.serialize($data).'|upload_file/files/cc'.$md5.'.pdf|upload_file/files/'.$md5.'.pdf'; //echo $path_upload.'|'.serialize($data).'|upload_file/images/'.$md5.'.jpg |upload_file/files/'.$_FILES["Filedata"]["name"].'.pdf'; //echo $path_upload.'|'.serialize($data).'|upload_file/images/img'.$md5.'.jpg'; // $_SESSION['scriptfile']= ('/upload_file/files/r'.$uploaddatafile1.".pdf"); //echo $path_upload.'|upload_file/files/c'.$filedata.'.pdf'; //$_SESSION['imagedata']= ('upload_file/images/img'.$md5.'.jpg'); } else { echo "1"; } } else { echo "1"; } } }