Wordpress Google Resim Botu

Wordpress resim botunu çoğu kişi ücretli satıyor. Fakat R10’dan @Ceu basit versiyonunu ücretsiz paylaşmış. Geliştirilebilir bir kod. Sadece wordpress için değil eğer bir script yazmak istiyorsanız bu uygulamanın kodlarını kullanabilirsiniz.  Bot yazdığınız kelimeleri google resimlerde arar ve resimleri ekrana çeker. Ve konunuza eklemeniz için kod olarak verir. Botun kurulumu kolay. Wordpress sitenizde ana dizine (public_html) bir php dosyası oluşturarak aşağıdaki kodu eklemeniz yeterli.

[php]
<?php
header(‘Content-Type: text/html; charset=utf-8’);

if($_POST) {

$query = urlencode($_POST[‘query’]);
$url = "http://www.uswebsitecreations.com/google_image_grabber/index.php?q=advance_search&as_st=y&tbm=isch&hl=en&as_q={$query}&imgc=value&safe=on&as_rights=not+filtered+by+license";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "");
$icerik = curl_exec($ch);
curl_close($ch);
$resimler = array();
foreach(json_decode($icerik) as $resim) {
array_push($resimler, $resim->imgurl);
$content .= ‘<img class="" src="’.$resim->imgurl.’" alt=" " width="400" height="300" /> <br/>’;
}
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>resim to Wordpress</title>

<!– Bootstrap –>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="http://getbootstrap.com/examples/blog/blog.css">

<!– HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries –>
<!– WARNING: Respond.js doesn’t work if you view the page via file:// –>
<!–[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]–>
</head>
<body>
<div class="blog-masthead">
<div class="container">
<nav class="blog-nav">
<a class="blog-nav-item active" href="#">resim to wordpress</a>

</nav>
</div>
</div>
<br>

<br/>

<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading">resim to Wordpress</div>
<div class="panel-body">
<div class="bs-example" data-example-id="basic-forms">
<form name="r10" action-xhr="#" method="POST">
<div class="bs-example" data-example-id="simple-thumbnails">
<div class="row">
<? if($_POST) {
foreach($resimler as $link) {
echo ‘<div class="col-xs-6 col-md-3">
<a href="#" class="thumbnail">
<img data-src="’.$link.’" alt="" src="’.$link.’" data-holder-rendered="true" style="height: 180px; width: 100%; display: block;">
</a>
</div>’;
}
?>
</div>
</div>
<textarea class="form-control" rows="15"><? echo $content; ?></textarea>
<? } else { ?>

<div class="form-group">
<label for="exampleInputPassword1">Ne ile ilgili resimler çekilsin</label>
<input type="text" name="query" class="form-control" id="exampleInputPassword1" placeholder="">
</div>

<button type="submit" class="btn btn-block btn-lg btn-info">Çek</button>
<? } ?>
</form>
</div>

</div>
</div></div>

</div>

<!– jQuery (necessary for Bootstrap’s JavaScript plugins) –>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</body>
</html>
[/php]

Cem Karakurt: