Exemplo n.º 1
0
 function save_news($newsDt, $cat, $insert = false)
 {
     if ($insert == false) {
         //echoPre($newsDt);
         $tmp = $this->gen_full_image($newsDt);
         $news_id = $newsDt['news_id'];
         if ($cat['cat_id'] == '') {
             $cat['cat_id'] = $cat['cat_name'];
         }
         $newsDt['news_category'] = json_encode(array($cat['cat_id']));
         echoPre($news_id);
         $newsDt['news_image_thumbnail'] = $newsDt['news_image_thumbnail'] != '' ? 'square-' . $newsDt['news_image'] : $newsDt['news_image_thumbnail'];
         $newsDt['news_image_potrait'] = $newsDt['news_image_potrait'] != '' ? 'poster-' . $newsDt['news_image'] : $newsDt['news_image_potrait'];
         $this->news_model->updateNews($newsDt, array('news_id' => $news_id));
         if ($newsDt['news_type'] == "1") {
             $photo = $this->photonews_model->get_data_record("photonews_newsid='{$news_id}'");
             $this->proses_detail_photonews($photo);
         }
         ////deleting news keyword data
         //$this->news_keywords_model->delete_records(array('nk_news_id' => $news_id));
         ////delete news tag data
         //$this->tag_news_model->delete_records(array('tag_news_news_id' => $news_id));
         $this->save_temp_img($tmp, $newsDt);
     } else {
         $newsDt['news_url'] = $newsDt['news_url'] . '-' . date("ymd") . get_random_alpanumeric(1);
         $news_id = $this->news_model->saveNewRecord($newsDt);
         // for insert jsview
         //$this->insert_jsview($news_id, $newsDt);
     }
     //echoPre($newsDt);
     //$this->update_jsview($news_id, $cat, $newsDt);
     //$this->update_rubric($news_id, $cat, $newsDt);
 }
Exemplo n.º 2
0
 function cropping_manual($folders)
 {
     //$dirTarget = $folders;
     $folders = array("/data/devel/media/men/klimg/photonews/2013/09/28/211082");
     foreach ($folders as $value) {
         $temp = array();
         $files = scandir($value);
         foreach ($files as $namefile) {
             if (substr($namefile, 0, 9) == "996xauto-") {
                 #$temp[] = $namefile;
                 $resize = array("664xauto", "996xauto");
                 $source_name = str_replace("996xauto-", "", $namefile);
                 echo "real : " . $value . '/' . $namefile . " name: " . str_replace(array('996xauto-', '.jpg'), '', $namefile) . " target: " . $value . '/<br>';
                 $ret = $this->upload->rezise_image($value . '/' . $source_name, str_replace(array('996xauto-', '.jpg'), '', $namefile), $value, $resize);
                 echoPre($ret);
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * function to upload photonews image into photonews dir
  * @param   $photo_id       int     photo_id field value from mdk_photo
  * @param   $photonews_id   int     news_id field value from mdk_news
  * @param   $orderNum       int     image ordering number
  */
 function _upload_photonewsImg($photo_id, $rowQuote, $orderNum = '', $isEcho = false)
 {
     //get mdk_photo record
     $this->upload = new Upload();
     //$photo_row = $this->selRow("mdk_photo", "photo_id=".$photo_id);
     $photo_row = $this->photo_model->get_data_record("photo_id=" . $photo_id, '', 0, 0);
     if (count($photo_row) > 0) {
         $photo_row = $photo_row[0];
     }
     if ($isEcho) {
         echoPre($photo_row);
     }
     //get mdk_news record
     //$news_row = $this->selRow("mdk_news", "news_id=".$photonews_id, '', $isEcho);
     //$news_row = $this->news_model->where("news_id=" . $photonews_id)->get('mdk_news');
     //$rowQuote = $this->quote_model->get_data("quote_id=" . $quote_id);
     //if (count($rowQuote) > 0)
     //    $rowQuote = $rowQuote[0];
     if ($isEcho) {
         echoPre($rowQuote);
     }
     $source_img = $this->config['klimg_dir'] . 'real/' . str_replace("-", "/", substr($photo_row['photo_entry'], 0, 10)) . '/' . $photo_row['photo_id'] . '/' . $photo_row['photo_url'];
     if ($isEcho) {
         echo '<br />$source_img : ' . $source_img;
     }
     $target_dir = $this->config['klimg_dir'] . 'quote/' . str_replace("-", "/", substr($rowQuote['quote_schedule'], 0, 10)) . '/' . $rowQuote['quote_id'] . '/';
     $this->upload->createDir($target_dir);
     if ($isEcho) {
         echo '<br />$target_dir : ' . $target_dir;
     }
     $order_rev = '';
     if ($rowQuote['quote_image'] != '') {
         $temp_ext = $this->upload->getExtension($rowQuote['quote_image']);
         $arrTemp = explode("-", str_replace("." . $temp_ext, "", $rowQuote['quote_image']));
         $order_rev = str_replace("rev", "", end($arrTemp));
         $order_rev = "-rev" . ($order_rev + 1);
     }
     $ext = $this->upload->getExtension($source_img);
     $target_imgName = $rowQuote['quote_url'] . ($orderNum ? "-" . str_pad($orderNum, 3, "0", STR_PAD_LEFT) : '') . $order_rev;
     if ($isEcho) {
         echo '<br />$target_imgName : ' . $target_imgName . '.' . $ext;
     }
     $target_img = $target_dir . $target_imgName;
     if ($isEcho) {
         echo '<br />$target_img : ' . $target_img;
     }
     $arrSize = $this->img_conf_model->get_data();
     $arrSize = $arrSize['photonews']['ratio_size'];
     #$return = $this->mdkUpload->copyAndResize($source_img, $target_dir, $target_imgName, $this->domainConf['img']['photonews']['ratio_size']);
     $return = $this->upload->copyAndResize($source_img, $target_imgName, $target_dir, $arrSize);
     //var_dump($return);
     if ($isEcho) {
         echoPre($return);
     }
     return $return;
 }
Exemplo n.º 4
0
 /**
  * function to prosesMediaImagePaging
  * @param   $photo_id       int     photo_id field value from mdk_photo
  * @param   $photonews_id   int     news_id field value from mdk_news
  * @param   $orderNum       int     image ordering number
  */
 function prosesMediaImagePaging($photo_id, $paging_id, $newsPaging, $orderNum = '', $isEcho = false, $suffix = '')
 {
     //get mdk_photo record
     $this->upload = new Upload();
     //$photo_row = $this->selRow("mdk_photo", "photo_id=".$photo_id);
     $photo_row = $this->photo_model->get_data_record("photo_id=" . $photo_id, '', 0, 0);
     if (count($photo_row) > 0) {
         $photo_row = $photo_row[0];
     }
     if ($isEcho) {
         echoPre($photo_row);
     }
     //get mdk_news record
     //$news_row = $this->selRow("mdk_news", "news_id=".$photonews_id, '', $isEcho);
     //$news_row = $this->news_model->where("news_id=" . $photonews_id)->get('mdk_news');
     $paging_row = $this->news_paging_model->get_data($paging_id);
     if (count($paging_row) > 0) {
         $paging_row = $paging_row[0];
     }
     $news_row = $this->news_model->dt_listData("news_id=" . $newsPaging['news_paging_news_id']);
     if (count($news_row) > 0) {
         $news_row = $news_row[0];
     }
     if ($isEcho) {
         echoPre($news_row);
     }
     if ($isEcho) {
         echoPre($paging_row);
     }
     $source_img = $this->config['klimg_dir'] . '/real/' . str_replace("-", "/", substr($photo_row['photo_entry'], 0, 10)) . '/' . $photo_row['photo_id'] . '/' . $photo_row['photo_url'];
     if ($isEcho) {
         echo '<br />$source_img : ' . $source_img;
     }
     $target_dir = $this->config['klimg_dir'] . '/news/' . str_replace("-", "/", substr($news_row['news_entry'], 0, 10)) . '/' . $news_row['news_id'] . '/paging/' . $paging_id;
     $this->upload->createDir($target_dir);
     if ($isEcho) {
         echo '<br />$target_dir : ' . $target_dir;
     }
     $order_rev = '';
     if ($paging_row['news_paging_path'] != '') {
         //$temp_ext = $this->upload->getExtension($paging_row['news_paging_path']);
         //$arrTemp = explode("-", str_replace("." . $temp_ext, "", $paging_row['news_paging_path']));
         //$order_rev = str_replace("rev", "", end($arrTemp));
         //$order_rev = "-rev" . ($order_rev + 1);
         $temp_ext = $this->upload->getExtension($news_row['news_paging_path']);
         $arrTemp = explode("-", str_replace("." . $temp_ext, "", $news_row['news_paging_path']));
         $pos = strpos(end($arrTemp), "rev");
         if ($pos === false) {
             $order_rev = "-rev1";
         } else {
             $order_rev = str_replace("rev", "", end($arrTemp));
             $order_rev = "-rev" . (intval($order_rev) + 1);
         }
     }
     $ext = $this->upload->getExtension($source_img);
     $target_imgName = $paging_row['news_paging_url'] . ($orderNum ? "-" . str_pad($orderNum, 3, "0", STR_PAD_LEFT) : '') . $suffix . $order_rev;
     if ($isEcho) {
         echo '<br />$target_imgName : ' . $target_imgName . '.' . $ext;
     }
     $target_img = $target_dir . $target_imgName;
     if ($isEcho) {
         echo '<br />$target_img : ' . $target_img;
     }
     $arrSize = $this->img_conf_model->get_data();
     $arrSize = $arrSize['news']['ratio_size'];
     #$return = $this->mdkUpload->copyAndResize($source_img, $target_dir, $target_imgName, $this->domainConf['img']['photonews']['ratio_size']);
     $return = @$this->upload->copyAndResize($source_img, $target_imgName, $target_dir, $arrSize);
     //var_dump($return);
     if ($isEcho) {
         echoPre($return);
     }
     return $return;
 }
Exemplo n.º 5
0
 /**
  * function to upload photonews image into photonews dir
  * @param   $photo_id       int     photo_id field value from mdk_photo
  * @param   $photonews_id   int     news_id field value from mdk_news
  * @param   $orderNum       int     image ordering number
  */
 function upload_photonewsImg($photo_id, $photonews_id, $orderNum = '', $isEcho = false, $suffix = '', $dir = "news")
 {
     //get mdk_photo record
     $this->upload = new Upload();
     //$photo_row = $this->selRow("mdk_photo", "photo_id=".$photo_id);
     $photo_row = $this->photo_model->get_data_record("photo_id=" . $photo_id, '', 0, 0);
     if (count($photo_row) > 0) {
         $photo_row = $photo_row[0];
     }
     if ($isEcho) {
         echoPre($photo_row);
     }
     //get mdk_news record
     //$news_row = $this->selRow("mdk_news", "news_id=".$photonews_id, '', $isEcho);
     //$news_row = $this->migrasi_model->where("news_id=" . $photonews_id)->get('mdk_news');
     $news_row = $this->migrasi_model->dt_listData("news_id=" . $photonews_id, 0, 10, "all");
     if (count($news_row) > 0) {
         $news_row = $news_row[0];
     }
     if ($isEcho) {
         echoPre($news_row);
     }
     $source_img = $this->config['klimg_dir'] . 'real/' . str_replace("-", "/", substr($photo_row['photo_entry'], 0, 10)) . '/' . $photo_row['photo_id'] . '/' . $photo_row['photo_url'];
     if ($isEcho) {
         echo '<br />$source_img : ' . $source_img;
     }
     $target_dir = $this->config['klimg_dir'] . $dir . '/' . str_replace("-", "/", substr($news_row['news_entry'], 0, 10)) . '/' . $news_row['news_id'] . '/';
     $this->upload->createDir($target_dir);
     if ($isEcho) {
         echo '<br />$target_dir : ' . $target_dir;
     }
     $order_rev = '';
     if ($news_row['news_image'] != '') {
         $temp_ext = $this->upload->getExtension($news_row['news_image']);
         $arrTemp = explode("-", str_replace("." . $temp_ext, "", $news_row['news_image']));
         $pos = strpos(end($arrTemp), "rev");
         if ($pos === false) {
             $order_rev = "-rev1";
         } else {
             $order_rev = str_replace("rev", "", end($arrTemp));
             $order_rev = "-rev" . (intval($order_rev) + 1);
         }
     }
     $ext = $this->upload->getExtension($source_img);
     $target_imgName = $suffix . $news_row['news_url'] . ($orderNum ? "-" . str_pad($orderNum, 3, "0", STR_PAD_LEFT) : '') . $order_rev;
     if ($isEcho) {
         echo '<br />$target_imgName : ' . $target_imgName . '.' . $ext;
     }
     $target_img = $target_dir . $target_imgName;
     if ($isEcho) {
         echo '<br />$target_img : ' . $target_img;
     }
     $arrSize = $this->img_conf_model->get_data();
     //$arrSize = $arrSize['news']['ratio_size'];
     if ($suffix == "square-") {
         $arrSize = $arrSize['square']['ratio_size'];
     } else {
         $arrSize = $arrSize[$dir]['ratio_size'];
     }
     #$return = $this->mdkUpload->copyAndResize($source_img, $target_dir, $target_imgName, $this->domainConf['img']['photonews']['ratio_size']);
     $return = $this->upload->copyAndResize($source_img, $target_imgName, $target_dir, $arrSize);
     //var_dump($return);
     if ($isEcho) {
         echoPre($return);
     }
     $tmp_img[] = str_replace($this->config['klimg_dir'], $this->config['klimg_url'], $return['target_img']);
     foreach ($return['dir_resize'] as $tmpdir) {
         $tmp_img[] = str_replace($this->config['klimg_dir'], $this->config['klimg_url'], $tmpdir);
     }
     $this->save_temp_img($tmp_img, $mdk_news);
     return $return;
 }
Exemplo n.º 6
0
 /**
  * function to upload photonews image into photonews dir
  * @param   $photo_id       int     photo_id field value from mdk_photo
  * @param   $photonews_id   int     news_id field value from mdk_news
  * @param   $orderNum       int     image ordering number
  */
 private function _upload_photonewsImg($photo_id, $photonews_id, $orderNum = '', $dir = 'news', $isEcho = false, $sufffix = '')
 {
     //get mdk_photo record
     $photo_row = $this->photonews_model->selRow($this->table_prefix . "photo", "photo_id=" . $photo_id, 'photo_id');
     if (count($photo_row) > 0) {
         $photo_row = $photo_row[0];
     }
     if ($isEcho) {
         echoPre($photo_row);
     }
     //get mdk_news record
     $tahun = date('Y');
     $news_row = $this->photonews_model->selRow($this->table_prefix . "news_" . $tahun, "news_id=" . $photonews_id, '', false);
     if (count($news_row) > 0) {
         $news_row = $news_row[0];
     }
     if ($isEcho) {
         echoPre($news_row);
     }
     if (isset($news_row['news_entry']) && $news_row['news_entry'] != '') {
         $source_img = $this->config['klimg_dir'] . 'real/' . str_replace("-", "/", substr($photo_row['photo_entry'], 0, 10)) . '/' . $photo_row['photo_id'] . '/' . $photo_row['photo_url'];
         if ($isEcho) {
             echo '$source_img : ' . $source_img;
         }
         $target_dir = $this->config['klimg_dir'] . $dir . '/' . str_replace("-", "/", substr($news_row['news_entry'], 0, 10)) . '/' . $news_row['news_id'];
         $this->upload->createDir($target_dir);
         if ($isEcho) {
             echo '$target_dir : ' . $target_dir;
         }
         $ext = $this->upload->getExtension($source_img);
         $order_rev = '';
         if ($news_row['news_image'] != '') {
             $temp_ext = $this->upload->getExtension($news_row['news_image']);
             $arrTemp = explode("-", str_replace("." . $temp_ext, "", $news_row['news_image']));
             $pos = strpos(end($arrTemp), "rev");
             if ($pos === false) {
                 $order_rev = "-rev1";
             } else {
                 $order_rev = str_replace("rev", "", end($arrTemp));
                 $order_rev = "-rev" . (intval($order_rev) + 1);
             }
         }
         //$target_imgName = url_title($news_row['news_title']) . (($orderNum) ? "-" . (str_pad($orderNum, 3, "0", STR_PAD_LEFT)) : '' );
         $target_imgName = $news_row['news_url'] . $sufffix . ($orderNum ? "-" . str_pad($orderNum, 3, "0", STR_PAD_LEFT) : '') . $order_rev;
         if ($isEcho) {
             echo '$target_imgName : ' . $target_imgName . '.' . $ext;
         }
         $target_img = $target_dir . '/' . $target_imgName;
         if ($isEcho) {
             echo '$target_img : ' . $target_img;
         }
         $arrSize = $this->img_conf_model->get_data();
         //$arrSize = $arrSize['news']['ratio_size'];
         $arrSize = $arrSize[$dir]['ratio_size'];
         //echoPre ($arrSize); die;
         $watermark = false;
         $arrCat = json_decode($news_row['news_category'], true);
         $carWatermark = array(17, 22, 23, 27, 41, 40);
         $cat = $arrCat[0];
         if (in_array($cat, $carWatermark)) {
             $watermark = true;
         }
         //var_dump($watermark);
         $return = $this->upload->copyAndResize($source_img, $target_imgName, $target_dir, $arrSize, $watermark);
     } else {
         $return = false;
     }
     if ($isEcho) {
         echoPre($return);
     }
     return $return;
 }
Exemplo n.º 7
0
 function update_editor($id_editor = "", $page = '1', $exe = "noexe")
 {
     echo $id_editor . ' - ' . $page . ' - ' . $exe;
     if ($id_editor == "") {
         exit("end force empty id editor");
     }
     $editor = array("24" => "iwan", "25" => "ferry", "26" => "gita", "30" => "Almo Dani", "31" => "Tedy", "32" => "Rinaldi", "33" => "product", "35" => "rolando.barail", "38" => "rita");
     $editor_new = $this->user_model->get_user_bycondition_dev("user_id='{$id_editor}'");
     //foreach($editor_new as $ed){
     $where = '';
     if (isset($editor[$editor_new[0]['user_id']])) {
         $where = "( news_editor LIKE '%\"" . $editor_new[0]['user_realname'] . "\"%' OR news_editor LIKE '%\"" . $editor[$editor_new[0]['user_id']] . "\"%' )";
     } else {
         $where = "news_editor LIKE '%\"" . $ed['user_realname'] . "\"%'";
     }
     $newsrow = $this->news_model->get_data_news($where, "all", $page, 100);
     if (is_array($newsrow) && count($newsrow) > 0) {
         foreach ($newsrow as $news) {
             echo $news['news_id'] . ' - ' . $news['news_editor'];
             $newEditor = json_encode(array(array('id' => $editor_new[0]['user_id'], 'user_fullname' => $editor_new[0]['user_realname'])));
             $upt = array("news_editor" => $newEditor);
             echoPre($upt);
             if ($exe == "exe") {
                 echo " update";
                 $this->news_model->updateNews($upt, array('news_id' => $news['news_id']));
             }
             echo "<hr>";
         }
     }
     //}
 }
Exemplo n.º 8
0
    }
    //echoPre($matches);
    // Create a branch of this code to manipulate
    foreach ($matches as $key => $value) {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                echo $v[0];
                //str_replace($v[0], , $subtitleBody, $changeCount)
            }
        }
    }
    //	$arrayCounter = 0;
    //	foreach ($cleanArray as $key => $value) {
    //	if ($arrayCounter == 0) {
    //		$subtitleFinal = substr_replace($subtitleBody, $value, $key, strlen($value) + 1);
    //	}
    //	else {
    //		$subtitleFinal = substr_replace($subtitleFinal, $value, $key, strlen($value));
    //	}
    //	$arrayCounter++;
    //	}
    //return $subtitleFinal;
    //	echoPre($subtitleBody);
    //	echoPre($cleanArray);
}
$cleanArray = processTimecodes(23.98);
//echo insertIntoString($cleanArray, $subtitleString);
echoPre($cleanArray);
?>
</body>
</html>
Exemplo n.º 9
0
 function croppopup()
 {
     $this->upload = new Upload();
     $photo_id = $this->uri->get('id', 0);
     $row = $this->mdk_photo->get_detail($photo_id);
     if (is_array($row) && count($row) > 0) {
         $row = $row[0];
         echoPre($row);
         #$klimg_file_location = $row['photo_path'].$this->domainConf['img']['realimage']['name_size']['tumb']."-".$row['photo_url'];
         $klimg_file_location = $this->config['klimg_url'] . $row['photo_path'] . $row['photo_url'];
         $local_file_location = str_replace($this->config['klimg_url'], $this->config['klimg_dir'], $klimg_file_location);
         $local_file_dir_location = explode("/", $local_file_location);
         $local_file_dir_location = str_replace(end($local_file_dir_location), "", $local_file_location);
         // hack path, development
         //$local_file_dir_location = str_replace ( 'http://cdn.klimg.com/merdeka.com/cms/img/jakarta.cms.merdeka.com/', $this->config['klimg_dir'), $local_file_dir_location );
         //$local_file_location = str_replace ( 'http://cdn.klimg.com/merdeka.com/cms/img/jakarta.cms.merdeka.com/', $this->config['klimg_dir'), $local_file_location );
         //
         //this part is only for DEVELOPMENT ONLY
         //in case if image in local directory is not exist, then grab from klimg-----------------------------------------------
         if (!file_exists($local_file_location)) {
             if ($aa = @file_get_contents($klimg_file_location)) {
                 $this->upload->createDir($local_file_dir_location);
                 file_put_contents($local_file_location, $aa);
                 //$this->klUpload->send_to_server( array($local_file_location) );
             } else {
                 echo '<div class="span6"><h1><br /><br /><br /><br /><br /><br />Failed to fetch Image Source File or file not found !</h1></div>';
                 exit;
             }
         }
         //end------------------------------------------------------------------------------------------------------------------
         //creating cropSize param
         $cropSize['size'][0] = '200x100';
         $cropSize['path'][0] = $local_file_dir_location;
         //END creating cropSize param
         $param = array('imgSrc' => $local_file_location, 'uniqueID' => $photo_id, 'cropSize' => $cropSize, 'imgUrl' => $klimg_file_location . '?' . date('ymgis'), 'submitUrl' => $this->config['base_url'] . $this->ctrler . '/cropSubmit/', 'include_freeResize' => true, 'ajaxSubmit' => false);
         //print_r($param);die;
         $content = $this->upload->build_cropCanvas($param);
     } else {
         $content = 'Image not found !';
     }
     echo $content;
 }