}
             }
         }
     }
 }
 $select_product_images = "SELECT p.product_image_small,p.product_image_big\n\t\t\t\t\t\t\t  \t\tFROM " . $tableprefix . "products p WHERE p.product_id =" . $_POST['product'] . " ";
 $result_product_images = mysql_query($select_product_images) or die(mysql_error());
 $rowimg = mysql_fetch_array($result_product_images);
 $product_image_small = $rowimg['product_image_small'];
 $product_image_big = $rowimg['product_image_big'];
 if ($product_image_small == '') {
     $product_image = $_FILES['txtImage_1']['name'];
     $picsmallname = ReplaceArrayImage($_FILES['txtImage_1']['name']);
     $picsmallorgname = $_FILES['txtImage_1']['name'];
     $picsmalltempname = $_FILES['txtImage_1']['tmp_name'];
     $picbigname = ReplaceArrayImage($_FILES['txtImage_1']['name']);
     $picsmalltype = $_FILES['txtImage_1']['type'];
     $picbigtype = $_FILES['txtImage_1']['type'];
     $picbigorgname = $_FILES['txtImage_1']['name'];
     $picbigtempname = $_FILES['txtImage_1']['tmp_name'];
     if ($picbigname != "") {
         $final_image_big = "productlarge_" . time() . $picbigname;
     } else {
         $final_image_big = "";
     }
     if ($picsmallname != "") {
         $final_image_small = "productsmall_" . time() . $picsmallname;
     } else {
         $final_image_small = "";
     }
     if ($picsmallname != "" || $picbigname != "") {
コード例 #2
0
if (isset($_REQUEST['stat']) && $_REQUEST['stat'] == 'Y') {
    $message = "Your products and images saved successfully!.";
}
$maximagesizestringinPHP = ini_get("upload_max_filesize");
$maximagesizeinPHP = $maximagesizestringinPHP * (1024 * 1024);
$sql_artists = "select artist_id,artist_name from " . $tableprefix . "artists where vapproved='Y' ";
$rs_id = mysql_query($sql_artists) or die(mysql_error());
$numrows = mysql_num_rows($rs_id);
if (isset($_POST['btnSave']) && $_POST['btnSave'] != '') {
    // check button for save
    $message = "";
    if (!isNotNull($_FILES['txtUploadZip']['name'])) {
        $message .= "* Upload a CSV file ! <br>";
    }
    $sellerid = $_POST['seller'];
    $uploadfile = ReplaceArrayImage($_FILES['txtUploadZip']['name']);
    $types = array('csv');
    preg_match('/\\.([a-zA-Z]+?)$/', $uploadfile, $matches);
    if (!in_array(strtolower($matches[1]), $types)) {
        // check file format is valid or not
        $message .= "* Invalid file format for CSV file ! <br>";
    }
    // end format check
    if (!empty($_FILES['txtUploadZip']['name'])) {
        // moving files to folder
        $filename = time() . strrchr(strtolower($_FILES['txtUploadZip']['name']), '.');
        $tempFile = $_FILES['txtUploadZip']['tmp_name'];
        $destFolder = "../csv/" . $filename;
        if ($_FILES['txtUploadZip']['size'] > $maximagesizeinPHP) {
            $message .= "*  Size exceeds. Maximum allowed size is {$maximagesizestringinPHP}.<br>";
        }
コード例 #3
0
             }*/
 /*
  * Product more images By Binu Chandran.E
  */
 $moreFiles = array();
 foreach ($_FILES['productMoreImage'] as $k => $l) {
     foreach ($l as $j => $v) {
         if (!array_key_exists($j, $moreFiles)) {
             $moreFiles[$j] = array();
         }
         $moreFiles[$j][$k] = $v;
     }
 }
 $dir_dest = "../products";
 for ($x = 0; $x < count($moreFiles); $x++) {
     $moreImageName = ReplaceArrayImage($moreFiles[$x]['name']);
     if ($moreImageName != "") {
         $handle = new Upload($moreFiles[$x]);
         if ($handle->uploaded) {
             $moreImageName = "productmore_" . $x . time() . $moreImageName;
             $moreImageName1 = "large_" . $moreImageName;
             $handle->file_new_name_body = substr($moreImageName1, 0, strrpos($moreImageName1, '.'));
             $handle->Process($dir_dest);
             $handle->image_resize = true;
             $handle->image_x = 75;
             $handle->image_y = 72;
             $handle->file_new_name_body = substr($moreImageName, 0, strrpos($moreImageName, '.'));
             $handle->Process($dir_dest);
             $moreImageName = $handle->file_dst_name;
             $insertMImageQuery = "INSERT INTO " . $tableprefix . "product_view_images\n                                                      SET nimage_productid = '" . mysql_real_escape_string($product_insert_id) . "',\n                                                          vimage_name= '" . mysql_real_escape_string($moreImageName) . "',\n                                                          vproduct_image_delete_status \t='N'";
             mysql_query($insertMImageQuery) or die(mysql_error());
コード例 #4
0
 if (file_exists($image_file_path)) {
     // check file folder exists
     $d = dir($image_file_path) or die("Wrong path: {$image_file_path}");
     while (false !== ($entry = $d->read())) {
         if ($entry != '.' && $entry != '..' && !is_dir($entry)) {
             $Images[] = $entry;
         }
     }
     // end while
     $d->close();
     if (is_array($Images) && !empty($Images)) {
         foreach ($Images as $value) {
             // forreach starts
             $imgname = $value;
             $exp = explode(".", $value);
             $newimage = ReplaceArrayImage($value);
             $pname = $exp[0];
             if ($pname != "Thumbs") {
                 // check thumb image exists
                 $sql_t = "select * from " . $tableprefix . "products where product_name='" . $pname . "'  and product_artist_id='" . $sellerid . "' \n\t\t\t  and product_image_small is null and  product_image_big is null ";
                 $rs_t = mysql_query($sql_t) or die(mysql_error());
                 $num_rows = mysql_num_rows($rs_t);
                 if ($num_rows > 0) {
                     $final_image_big = "productlarge_" . time() . $newimage;
                     $final_image_small = "productsmall_" . time() . $newimage;
                     $picsmalldest = $prodimagedir . $final_image_small;
                     $picbigdest = $prodimagedir . $final_image_big;
                     $picsmallname = $final_image_small;
                     $picbigname = $final_image_big;
                     //checking extension and replace
                     $replaceArray = array('jpg', 'jpeg', 'gif');
コード例 #5
0
     }
 }
 if ($picbigtype != "") {
     if (!isValidWebImageType($picbigtype, $picbigfilename, $picbigtempname)) {
         $message .= " * Invalid product picture (big)! Upload an image (jpg/gif/png)" . "<br>";
         $error = true;
     } else {
         if (file_exists($picbigdest)) {
             $message .= " * Product picture (big) with the same name exists! Please rename the product picture (big) and upload! " . "<br>";
             $error = true;
         }
     }
 }
 /*----Digital Product Block Starts-------*/
 if (isNotNull($_FILES['txtProductZip']['name'])) {
     $uploadfile = ReplaceArrayImage($_FILES['txtProductZip']['name']);
     $types = array('zip', 'pdf', 'rar', 'psd', 'opf', 'azw', 'lit', 'pdb', 'pkg', 'mp3', 'mpeg', 'mp4', 'avi');
     preg_match('/\\.([a-zA-Z]+?)$/', $uploadfile, $matches);
     if (!in_array(strtolower($matches[1]), $types)) {
         // check file format is valid or not
         $message .= "* Invalid file format for Digital Product! <br>";
     }
     // end format check
 }
 /*----Digital Product Block Ends-------*/
 if ($message != "") {
     // error
     $message = "<br>Please correct the following errors to continue!<br>" . $message;
 } else {
     // no error so insert user details
     if ($picsmallname != "") {