我正在使用引导程序图库来显示我的图像,这是使用模态显示的,当您单击图像时,它将在另一个模态中打开,您可以在其中看到图像的原始大小。这里唯一的问题是只有第一张图片变成了垃圾,其余图片都正常显示。
图片的垃圾或字符串信息:
的GIF89a%FFF!,%P N {Ÿ的vE和放大器;:!@ 3` + TQ”。 7q9 ķ}f nzܺx ePb E c W @升He&هɘE)y8 J 9 ɧ ' (j JIT {ʚ([Y9; | [HL +,\; =ݝ; \ J-NMN ] DTD〜S'LtOW 3l |0 A :|1 ĉ+Z 1 1 t F~4#% %EQAyJ'_M2cy(ҖBN?U“4 + TQJ uҜ>} (UI ۂ = [פnѾwܰ瓦特^ M | M Ì“N \ + 7F ü^ʏ[S;
生成模态内容的控制器内的代码:
$data[] = '<div class="panel panel-primary">';
$data[] = '<div class="panel-heading">';
$data[] = 'Attachments';
$data[] = '</div>';
$data[] = '<div class="panel-body">';
$data[] = '<div class="row">';
$attachemnt_img = DB::table('attachment')->where('session_id', $input)->get();
$data[] = '<div id="links">';
foreach($attachemnt_img as $img_url){
$data[] = '<a href="uploads\images\\'.$img_url->url.'" title="Banana" data-gallery data-toggle="modal" data-target="#myModal2">';
$data[] = '<img src="uploads\images\\'.$img_url->url.'" width="20%" alt="Banana">';
$data[] = '</a>';
$url = $img_url->url;
}
$data[] = '</div>';
$data[] = '</div>';
$data[] = '</div>';
$data[] = '<div id="blueimp-gallery" class="blueimp-gallery">';
$data[] = '<div class="slides"></div>';
$data[] = '<h3 class="title"></h3>';
$data[] = '<a class="prev">‹</a>';
$data[] = '<a class="next">›</a>';
$data[] = '<a class="close">×</a>';
$data[] = '<a class="play-pause"></a>';
$data[] = '<ol class="indicator"></ol>';
$data[] = '<div id="myModal2" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
$data[] = '<div class="modal-dialog">';
$data[] = '<div class="modal-content">';
$data[] = '<div class="modal-header">';
$data[] = '<button type="button" class="close" aria-hidden="true">×</button>';
$data[] = '<h4 class="modal-title"></h4>';
$data[] = '</div>';
$data[] = '<div class="modal-body next"></div>';
$data[] = '<div class="modal-footer">';
$data[] = '<button type="button" class="btn btn-default pull-left prev">';
$data[] = '<i class="glyphicon glyphicon-chevron-left"></i>';
$data[] = 'Previous';
$data[] = '</button>';
$data[] = '<button type="button" class="btn btn-primary next">';
$data[] = 'Next';
$data[] = '<i class="glyphicon glyphicon-chevron-right"></i>';
$data[] = '</button>';
$data[] = '</div>';
$data[] = '</div>';
$data[] = '</div>';
$data[] = '</div>';
$data[] = '</div>';
$data[] = '</div>';
我的AJAX:
function viewModal(id){
var mystring, stringie;
$.ajax({
type: "POST",
url: baseUrl + '/modalView',
data: {id:id, "_token": token},
dataType: "json",
success: function(data){
stringie = data.toString();
mystring = stringie.replace(/[,]/g, '');
$(".modal-content").html(mystring);
},
statusCode: {
500: function() {
},
422: function(data) {
//
}
}
});
}
视野中的模式:
<div id="myModal" class="modal fade " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" style="max-width: 1300px;">
<div class="modal-content">
</div>
</div>
</div>