PDOでpixtabay apiの情報をmysqlに入れる

<?php

$apikey = "donot watch";
$query = "apple+watch";
$type = "photo"; 
//  "all", "photo", "illustration", "vector" 
$cate = "fashion";
// fashion, nature, backgrounds, science, education, people, feelings, religion, health, places, animals, industry, food, computer, sports, transportation, travel, buildings, business, music
$lang = "";

$orientation = "";
//"all", "horizontal", "vertical" 
$per_page = "";
//Accepted values: 3 - 200 
$order = "";
//"popular", "latest" 
$per_page = "";
//Accepted values: 3 - 200 

$baseurl = "https://pixabay.com/api/?key=". $apikey."&q=".$query."&image_type=".$type."&lang=ja&category=".$cate."";


$json = file_get_contents($baseurl);
$obj = json_decode($json);


// print_r('<pre>');
// var_dump($obj);
// print_r('</pre>');

foreach($obj->hits as $value){
	$url[] = $value->webformatURL;
	$tags[] = $value->tags;
}

$dsn = "mysql:dbname=img;host=localhost";
$user = "hoge";
$password = "hogehoge";
 
try {
    $dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e){
    print('connection failed:'.$e->getMessage());
}

$stmt = $dbh -> prepare("INSERT INTO pixtabay (imgurl, tags) VALUES(:imgurl, :tags)");

$date = date("Ymt");
$i=0;
foreach($url as $value){
    $pass = "img/" .$date. "-" . $i . ".jpeg";
    $stmt->bindParam(':imgurl', $pass, PDO::PARAM_STR);
    $stmt->bindParam(':tags', $tags[$i], PDO::PARAM_STR);
    $stmt->execute();
    $i++;
}
?>

入ってますね♪

問題は画像の重複ですが。。。