我正在构建一个图像列表,可以使用 Cropper js 通过 boostrap 模式进行修改。
<% crop.forEach(function(crops) { %>
<div class="card mb-4 box-shadow" style="margin-right: 1em;">
<img data-enlargable class="card-img-top" src="/photos/cropped_images/<%= crops.cat_nom %>/<%= crops.nom %>"
alt="<%= crops.nom %>" style="max-height: 255px; max-width: 348px; object-fit: contain; cursor: zoom-in;">
<input type="hidden" id="dataImage" data-catname="<%= crops.cat_nom %>" data-idcrop="<%= crops.cropped_id %>">
<div class="card-body">
<h5 class="card-title"><%= crops.cat_nom %></h5>
<p class="card-text"><%= crops.nom %></p>
<div class="d-flex justify-content-between align-items-center">
<div class="btn-group">
<button type="button" name="edit" class="btn btn-sm btn-outline-secondary"
data-path="/photos/cropped_images/<%= crops.cat_nom %>/<%= crops.nom %>"
data-target="#modal" data-toggle="modal">Edit</button>
</div>
</div>
</div>
</div>
<% }) %> …Run Code Online (Sandbox Code Playgroud)