예제 #1
0
 function createThumbnail($oldImage, $newImage, $width = 150, $height = "")
 {
     $t = new thumbnail_images();
     $t->PathImgOld = $oldImage;
     $t->PathImgNew = $newImage;
     $t->NewHeight = $height;
     $t->NewWidth = $width;
     if ($t->create_thumbnail_images()) {
         return true;
     }
     return false;
 }
 public function createimage($width, $height, $destination, $thumb, $name, $type)
 {
     $obj_imgl = new thumbnail_images();
     $obj_imgl->PathImgOld = $destination . "/" . $name . "." . $type;
     $obj_imgl->PathImgNew = $destination . $thumb . "/" . $name . "." . $type;
     $obj_imgl->NewWidth = $width;
     if ($height != '') {
         $obj_imgl->NewHeight = $height;
     }
     if (!$obj_imgl->create_thumbnail_images()) {
         echo "error";
     }
 }
예제 #3
0
 public function createimage($width, $height, $destination, $thumb, $type)
 {
     //echo $type;
     //echo "<br>";
     $obj_imgl = new thumbnail_images();
     $obj_imgl->SetImageType = $type;
     $obj_imgl->PathImgOld = $destination . "." . $type;
     $obj_imgl->PathImgNew = $destination . "{$thumb}." . $type;
     $obj_imgl->NewWidth = $width;
     if ($height != '') {
         $obj_imgl->NewHeight = $height;
     }
     //echo "<pre>";
     //print_r($obj_imgl);
     //die;
     if (!$obj_imgl->create_thumbnail_images()) {
         //echo "error";
         //die('not uploaded');
         return 1;
     } else {
         return 0;
     }
 }
예제 #4
0
}
if (isset($_POST['submit']) and isset($_POST['news_id'])) {
    $img_res = mysql_query('SELECT * FROM tbl_news WHERE nid=\'' . $_POST['news_id'] . '\'');
    $img_row = mysql_fetch_assoc($img_res);
    if ($img_row['news_image'] != "") {
        unlink('upload/' . $img_row['news_image']);
        unlink('upload/thumbs/' . $img_row['news_image']);
    }
    if ($_FILES['news_image']['name'] != "") {
        if ($_FILES['news_image']['type'] == "image/jpg" or $_FILES['news_image']['type'] == "image/jpeg" or $_FILES['news_image']['type'] == "image/png" or $_FILES['news_image']['type'] == "image/gif" or $_FILES['news_image']['type'] == "image/bmp") {
            $news_image = rand(0, 99999) . "_" . $_FILES['news_image']['name'];
            $pic1 = $_FILES['news_image']['tmp_name'];
            $tpath1 = 'upload/' . $news_image;
            copy($pic1, $tpath1);
            $thumbpath = 'upload/thumbs/' . $news_image;
            $obj_img = new thumbnail_images();
            $obj_img->PathImgOld = $tpath1;
            $obj_img->PathImgNew = $thumbpath;
            $obj_img->NewWidth = 72;
            $obj_img->NewHeight = 72;
            if (!$obj_img->create_thumbnail_images()) {
                echo $_SESSION['msg'] = "Thumbnail not created... please upload image again";
                exit;
            }
            $data = array('cat_id' => $_POST['category_id'], 'news_heading' => addslashes($_POST['news_heading']), 'news_description' => addslashes($_POST['news_description']), 'news_date' => $_POST['news_date'], 'news_image' => $news_image);
        }
    } else {
        $data = array('cat_id' => $_POST['category_id'], 'news_heading' => addslashes($_POST['news_heading']), 'news_description' => addslashes($_POST['news_description']), 'news_date' => $_POST['news_date']);
    }
    $news_edit = Update('tbl_news', $data, "WHERE nid = '" . $_POST['news_id'] . "'");
    if ($news_edit > 0) {