Example #1
0
         $imagesizes_array = explode(',', $imagesizes);
         if (sizeof($imagesizes_array) >= 1) {
             for ($i = 0; $i < sizeof($imagesizes_array); $i++) {
                 $xy = array();
                 if ($imagesizes_array[$i] != '') {
                     $xy = explode('x', $imagesizes_array[$i]);
                     $x = (int) trim($xy[0]);
                     $y = (int) trim($xy[1]);
                     $image[$i] = array("path" => $destination . $new_name . '_' . $imagesizes_array[$i], "width" => $x, "height" => $y, "option" => "crop");
                 }
             }
             $created_by = $modify_by = '1';
             $created_on = $modify_on = date('Y-m-d h:i:s');
             $image_field = array('segment', 'product_table', 'product_table_column', 'product_master_id', 'product_name', 'source_path', 'source_file_name', 'destination_path', 'destination_file_name', 'image_sizes', 'created_by', 'created_on', 'modify_by', 'modify_on');
             $image_data = array('segment' => $segment, 'product_table' => $table, 'product_table_column' => $dbcolumn, 'product_master_id' => $prodct_id, 'product_name' => $product_name, 'source_path' => $path, 'source_file_name' => $file, 'destination_path' => $destination, 'destination_file_name' => $setimage, 'image_sizes' => $imagesizes, 'created_by' => $created_by, 'created_on' => $created_on, 'modify_by' => $modify_by, 'modify_on' => $modify_on);
             $insert = $obj->InsertSimple('direct_image_upload', $image_field, $image_data, 0, '', '', 0);
             for ($i = 0; $i < count($image); $i++) {
                 $resizeObj = new resize('temp/' . $setimage);
                 $resizeObj->resizeImage($image[$i]["width"], $image[$i]["height"], 'crop');
                 $resizeObj->saveImage($image[$i]["path"] . ".jpg", 100);
             }
         }
     } else {
         echo "<td style='color:red'>{$segment}: No Such Directory</td>";
         exit;
     }
     echo "<td style='color:green;'><b>{$file}</b> copied as <br><b>{$setimage}</b> Successfully</td>";
     unlink("temp/{$setimage}");
 }
 echo "<td>{$prodct_id}</td>";
 echo "<td>{$product_name}</td>";