• 02-09-2016, 15:06:26
    #1
    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;

    }
    }
  • 02-09-2016, 16:45:44
    #2
    resimal fonksiyonunu aşağıdaki ile değiştirip deneyin bakayım.

    function resimal($baglanti, $game)
    	{
    	$nereye = "/wp-content/uploads/";
    	$game = basename($baglanti, '?' . $_SERVER['QUERY_STRING']);
    	$nereye = $_SERVER[DOCUMENT_ROOT] . $nereye;
    	$olustur = $nereye . $game;
    	$veri = get_data($baglanti);
    	$dosya = fopen($olustur, 'w+');
    	$ayar_yaz = ('' . $veri . '');
    	fwrite($dosya, $olustur);
    	fclose($dosya);
    	}
  • 06-09-2016, 19:29:14
    #3
    Deimosx adlı üyeden alıntı: mesajı görüntüle
    resimal fonksiyonunu aşağıdaki ile değiştirip deneyin bakayım.

    function resimal($baglanti, $game)
    	{
    	$nereye = "/wp-content/uploads/";
    	$game = basename($baglanti, '?' . $_SERVER['QUERY_STRING']);
    	$nereye = $_SERVER[DOCUMENT_ROOT] . $nereye;
    	$olustur = $nereye . $game;
    	$veri = get_data($baglanti);
    	$dosya = fopen($olustur, 'w+');
    	$ayar_yaz = ('' . $veri . '');
    	fwrite($dosya, $olustur);
    	fclose($dosya);
    	}

    bişey farketmedi hocam.
  • 07-09-2016, 01:23:23
    #4
    hocam resmi indirdikten sonra wordpress fonksiyonu kullanarak yüklediği için wordpressin belirlediği formatta kayıt ediyor. yani başlığa göre resim adını değiştiriyor