Arkadaşlar elimde bir php bot var kaynak siteden çektiği resimlerin ismini değiştirerek konu başlığını isim olarak atayarak kayıt ediyor sunucuya ben bunu istemiyorum orjinal ismiyle çeksin istiyorum resimleri kaydet php dosyası ilgili kısım içeriği altta nasıl bir düzenleme gerekiyor acaba.
function resimal($baglanti,$game){
$nereye="/wp-content/uploads/";
$nereye = $_SERVER[DOCUMENT_ROOT].$nereye;
$olustur = $nereye.$game.".jpg";
$veri=get_data($baglanti);
$dosya = fopen($olustur, 'w+');
$ayar_yaz =(''.$veri.'');
fwrite($dosya, $ayar_yaz);
fclose($dosya);
}
function bellek_al($baglanti,$game){
$nereye="cache/";
$olustur = $nereye.$game."";
$veri=get_data($baglanti);
$dosya = fopen($olustur, 'w+');
$ayar_yaz =(''.$veri.'');
fwrite($dosya, $ayar_yaz);
fclose($dosya);
}
function wp_resim_ekle($url, $pid, $bas = null, $tita = null, $von=null, $ozelalan = null){
$filename = $bas."";
$filename = remove_accents($filename);
if (function_exists('mb_strtolower')) {
$filename = mb_strtolower($filename, 'UTF-8');
}
$filename = utf8_uri_encode($filename);
$filetype = wp_check_filetype($url);
extract($filetype);
if (!$type) $type = "";
$upload = wp_upload_bits($filename, $filetype, @get_data($url));
if ( !empty($upload['error']) ) {
return "Resim eklenemedi!<br />Hata: ".$upload['error']."<br />";
} else {
$neyim = $upload['file'];
$attachment = array(
'guid' => $upload['url'],
'post_mime_type' => $type,
'post_title' => $tita,
'post_content' => $von,
'post_type' => 'attachment',
'post_parent' => $pid
);
$attach_id = wp_insert_attachment($attachment, $neyim, $pid);
$attach_data = wp_generate_attachment_metadata($attach_id, $neyim);
wp_update_attachment_metadata($attach_id, $attach_data);
add_post_meta($pid, '_thumbnail_id', $attach_id, true);
$neyim=$upload['url'];
return $neyim;
}
}