xử lý cả 2 trường hợp: chọn ảnh từ URL và upload file thật (ok)
🔹 1. Trong Form View
{{-- Chọn ảnh từ File Manager --}}
<label>Hình đại diện (URL)</label>
<div class="input-group mb-3">
<input id="thumbnail" class="form-control" type="text" name="featured_image_url" value="{{ old('featured_image_url', $post->featured_image_url ?? '') }}">
<button type="button" class="btn btn-secondary" onclick="openLfm()">Chọn ảnh</button>
</div>
<img id="holder" src="{{ old('featured_image_url', $post->featured_image_url ?? '') }}" style="max-height: 100px">
{{-- Upload ảnh từ máy --}}
<label>Hoặc upload ảnh (file)</label>
<input type="file" name="featured_image_file" class="form-control">
2. Trong Controller
PreviousGộp toàn bộ phần khởi tạo CKEditor và xử lý ảnh vào 1 file JS riêngNextHiển thị ảnh có chứa https, http và không chứa https, http (ok)
Last updated