ok
Direktori : /home2/selectio/www/application/views/dashboard/product/ |
Current File : /home2/selectio/www/application/views/dashboard/product/_image_upload_box.php |
<?php defined('BASEPATH') or exit('No direct script access allowed'); ?> <div class="dm-uploader-container"> <div id="drag-and-drop-zone" class="dm-uploader text-center" style="padding: 20p"> <p class="dm-upload-icon"> <i class="icon-upload"></i> </p> <p class="dm-upload-text"><?php echo trans("drag_drop_images_here"); ?> <span style="text-decoration: underline"><?php echo trans('browse_files'); ?></span></p> <a class='btn btn-md dm-btn-select-files'> <input type="file" name="file" size="100" multiple="multiple"> </a> <ul class="dm-uploaded-files" id="files-image"> <?php $uploaded_image_count = 0; if (!empty($modesy_images)): foreach ($modesy_images as $modesy_image): $uploaded_image_count += 1; ?> <li class="media" id="uploaderFile<?php echo $modesy_image->file_id; ?>"> <img src="<?php echo base_url(); ?>uploads/temp/<?php echo $modesy_image->img_small; ?>" alt=""> <a href="javascript:void(0)" class="btn-img-delete btn-delete-product-img-session" data-file-id="<?php echo $modesy_image->file_id; ?>"> <i class="icon-close"></i> </a> <?php if ($modesy_image->is_main == 1): ?> <a href="javascript:void(0)" class="btn btn-xs btn-success btn-is-image-main btn-set-image-main-session"><?php echo trans("main"); ?></a> <?php else: ?> <a href="javascript:void(0)" class="btn btn-xs btn-secondary btn-is-image-main btn-set-image-main-session" data-file-id="<?php echo $modesy_image->file_id; ?>"><?php echo trans("main"); ?></a> <?php endif; ?> </li> <?php endforeach; endif; ?> </ul> </div> </div> <div class="row-custom"> <p class="images-exp"><i class="icon-exclamation-circle"></i><?php echo trans("product_image_exp"); ?></p> </div> <script type="text/html" id="files-template-image"> <li class="media"> <img class="preview-img" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="bg"> <div class="media-body"> <div class="progress"> <div class="dm-progress-waiting"><?php echo trans("waiting"); ?></div> <div class="progress-bar" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div> </div> </div> </li> </script> <script> var image_limit = <?= $this->general_settings->product_image_limit; ?>; var image_upload_count = <?= $uploaded_image_count; ?>; $(function () { $('#drag-and-drop-zone').dmUploader({ url: '<?php echo base_url(); ?>upload-image-session-post', maxFileSize: <?php echo $this->general_settings->max_file_size_image; ?>, queue: true, allowedTypes: 'image/*', extFilter: ["jpg", "jpeg", "png", "gif"], extraData: function (id) { return { "file_id": id, "<?php echo $this->security->get_csrf_token_name(); ?>": $.cookie(csfr_cookie_name) }; }, onDragEnter: function () { this.addClass('active'); }, onDragLeave: function () { this.removeClass('active'); }, onNewFile: function (id, file) { if (image_upload_count >= image_limit) { swal({ text: "<?= trans("error_image_limit");?>", icon: "warning", button: sweetalert_ok }); return false; } ui_multi_add_file(id, file, "image"); if (typeof FileReader !== "undefined") { var reader = new FileReader(); var img = $('#uploaderFile' + id).find('img'); reader.onload = function (e) { img.attr('src', e.target.result); } reader.readAsDataURL(file); } image_upload_count++; }, onBeforeUpload: function (id, file) { $('#uploaderFile' + id + ' .dm-progress-waiting').hide(); ui_multi_update_file_progress(id, 0, '', true); ui_multi_update_file_status(id, 'uploading', 'Uploading...'); }, onUploadProgress: function (id, percent) { ui_multi_update_file_progress(id, percent); }, onUploadSuccess: function (id, data) { var data = { "file_id": id, "sys_lang_id": sys_lang_id }; data[csfr_token_name] = $.cookie(csfr_cookie_name); $.ajax({ type: "POST", url: base_url + "get-sess-uploaded-image-post", data: data, success: function (response) { var obj = JSON.parse(response); if (obj.result == 1) { document.getElementById("uploaderFile" + id).innerHTML = obj.image_html; } } }); ui_multi_update_file_status(id, 'success', 'Upload Complete'); ui_multi_update_file_progress(id, 100, 'success', false); }, onFileSizeError: function (file) { swal({ text: "<?php echo trans('file_too_large') . ' ' . formatSizeUnits($this->general_settings->max_file_size_image); ?>", icon: "warning", button: sweetalert_ok }); }, onFileTypeError: function (file) { swal({ text: "<?= trans("invalid_file_type");?>", icon: "warning", button: sweetalert_ok }); }, onFileExtError: function (file) { swal({ text: "<?php echo trans('invalid_file_type'); ?>", icon: "warning", button: sweetalert_ok }); } }); }); </script>