如何在Krajee bootstrap中预览和删除图像?

时间:2017-03-28 11:56:10

标签: php jquery codeigniter

这是初始化文件输入的设置。我已成功完成上传文件,但我想编辑,而不能在krajee bootstrap输入的容器中预览图像。如果有人知道请提供完整的代码删除和预览。

 $("#userfiles").fileinput({
              'dropZoneEnabled': true,
              'maxFileCount': totalcount,
              'showUpload': false,
              'browseLabel': "Click Here or Drag & Drop Images Here",
              'browseIcon': "<i class=\"glyphicon glyphicon-picture\"></i> ",
              'validateInitialCount': true,
              'allowedFileExtensions': ["jpg", "png", "gif", "jpeg"],
              'showCaption': true,
              'showPreview': true,
              'showRemove': true
 }); 

 //This is the ajax for get images from database

 $.ajax({
type: "POST",
url: site_url+'posting/getpicdata',
data: {pid: url},
dataType: "json",
success: function(response)
    {
      //console.log(response);
      //var result = JSON.parse(response);

    $.each(response, function(k, v) {
      //display the key and value pair
      //console.log(v.url);
      image_html = v.imgname;
    appendHTML +='<div data-template="image" data-fileindex="0" id="'+v.imgname+'" class="file-preview-frame krajee-default  file-preview-initial file-sortable kv-preview-thumb">';
        appendHTML +='<div class="kv-file-content">';
        appendHTML +='<img style="width:auto;height:160px;"" alt="'+v.imgname+'" title="'+v.imgname+'" class="kv-preview-data file-preview-image" src="'+v.url+'">';
        appendHTML +='</div>';
        appendHTML +='<div class="file-thumbnail-footer">';
        appendHTML +='<div title="'+v.imgname+'" class="file-footer-caption">'+v.imgname+' <br></div>';
        appendHTML +='<div class="file-thumb-progress hide">';
        appendHTML +='<div class="progress">';
        appendHTML +='<div style="width:0%;" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" class="progress-bar progress-bar-success progress-bar-striped active">0%</div>';
        appendHTML +='</div>';
        appendHTML +='</div>';
        appendHTML +='<div class="file-actions">';
        appendHTML +='<div class="file-footer-buttons">';
        appendHTML +='<button title="Remove file" data-id="'+v.imgname+'" class="kv-file-remove btn btn-xs btn-default" type="button"><i class="glyphicon glyphicon-trash text-danger"></i></button>';
        appendHTML +='</div>';
        appendHTML +='<div title="Not uploaded yet" class="file-upload-indicator"><i class="glyphicon glyphicon-hand-down text-warning"></i></div>';
        appendHTML +='<div class="clearfix"></div>';
        appendHTML +='</div>';
        appendHTML +='</div>';
        appendHTML +='</div>';


  });

1 个答案:

答案 0 :(得分:0)

目前还不完全清楚你在寻找什么,但我认为它是这样的......

INSTALL_DIR='/tmp'

install_app() {

 echo "application path - $INSTALL_DIR"

}

install_app