<pre>
×
Resim Düzenleme
Resim Adı
*Resim adı Tükçe karakter içermemeli*
Başlık
Özet
Detay
CKEDITOR.replace('detay');
CKEDITOR.replace('detay',{
filebrowserBrowseUrl: '/browser/browse.php',
filebrowserImageBrowseUrl: '/browser/browse.php?type=Images',
filebrowserUploadUrl: '/uploader/upload.php',
filebrowserImageUploadUrl: '/uploader/upload.php?type=Images',
filebrowserWindowWidth: '900',
filebrowserWindowHeight: '400',
filebrowserBrowseUrl: '/ckfinder/ckfinder.html',
filebrowserImageBrowseUrl: '/ckfinder/ckfinder.html?Type=Images',
filebrowserFlashBrowseUrl: '/ckfinder/ckfinder.html?Type=Flash',
filebrowserUploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
filebrowserImageUploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
filebrowserFlashUploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
});
Kapat
Ajax kodları
$(document).ready(function(){
load_image_data();
function load_image_data()
{
$.ajax({
url:"fetch.php",
method:"POST",
success:function(data)
{
$('#image_table').html(data);
}
});
}
$('#multiple_files').change(function(){
var error_images = '';
var form_data = new FormData();
var files = $('#multiple_files')[0].files;
if(files.length > 1)
{
error_images += 'sadece 1 resim seçilebilir';
}
else
{
for(var i=0; i<files.length; i++)
{
var name = document.getElementById("multiple_files").files[i].name;
var ext = name.split('.').pop().toLowerCase();
if(jQuery.inArray(ext, ['gif','png','jpg','jpeg']) == -1)
{
error_images += 'Geçersiz '+i+' dosya';
}
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("multiple_files").files[i]);
var f = document.getElementById("multiple_files").files[i];
var fsize = f.size||f.fileSize;
if(fsize > 2000000)
{
error_images += '' + i + ' Dosya boyutu çok büyük';
}
else
{
form_data.append("file[]", document.getElementById('multiple_files').files[i]);
}
}
}
if(error_images == '')
{
$.ajax({
url:"upload.php",
method:"POST",
data: form_data,
contentType: false,
cache: false,
processData: false,
beforeSend:function(){
$('#error_multiple_files').html('Yükleniyor');
},
success:function(data)
{
$('#error_multiple_files').html('Başarıyla Yüklendi');
load_image_data();
}
});
}
else
{
$('#multiple_files').val('');
$('#error_multiple_files').html(""+error_images+"");
return false;
}
});
$(document).on('click', '.edit', function(){
var image_id = $(this).attr("id");
$.ajax({
url:"edit.php",
method:"post",
data:{image_id:image_id},
dataType:"json",
success:function(data)
{
$('#imageModal').modal('show');
$('#image_id').val(image_id);
$('#image_name').val(data.image_name);
$('#image_description').val(data.image_description);
$('#ozet').val(data.ozet);
$('#detay').val(data.detay);
}
});
});
$(document).on('click', '.delete', function(){
var image_id = $(this).attr("id");
var image_name = $(this).data("image_name");
if(confirm("Silmek istediğinizden emin misiniz?"))
{
$.ajax({
url:"delete.php",
method:"POST",
data:{image_id:image_id, image_name:image_name},
success:function(data)
{
load_image_data();
swal("Kayıt Silme !!", "Kayıt veritanından Silindi!!", "success");
}
});
}
});
$('#edit_image_form').on('submit', function(event){
event.preventDefault();
if($('#image_name').val() == '')
{
alert("Resim Adı giriniz");
}
else
{
$.ajax({
url:"update.php",
method:"POST",
data:$('#edit_image_form').serialize(),
success:function(data)
{
$('#imageModal').modal('hide');
load_image_data();
swal("Silme İşlemi !!", "Kayıt Başarıyla Güncellendi!!", "success");
}
});
}
});
});
yardımcı olursanız sevinirim. iyi çalışmalar</pre>