Kendi projem için lazım olan bir botu ücretsiz olarak sunuyorum
Ne işe Yarar ?
Download Sitesi İçin resim eklemeye çok yarar mesela, Resim galeriniz varsa oraya resim çekmeye yarar
kısacası her hangi bir sitede gördüğünüz resmi kendi hostunuza çekmeye yarar gerisi sizin hayal gücünüze / kod düzenleme uygulama bilginize kalmış.
2 adet klasör gerekiyor hostinginize
1 botumuz buraya alacak bu yüzden chmod 777 gereklidir işlem sonrası buradaki resim silinir botu aldığınız gibi kullanmayınız
$resimKlasorum = 'tmp/';
2 son işlem resimler burada saklanacak
$handle->Process("images");
Bu iki yeri mutlaka ama mutlaka değiştiriniz
index.php
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript">
function addc(){
$('#scss').slideDown('slow');
$("#scss").html('Alınıyor ...');
$.ajax({
type:'POST',
url:'bot.php',
data:$('#Url').serialize(),
success:function(snc){
$("#scss").html(snc)
}
})
}
</script>
<form id="Url" enctype="multipart/form-data">
<input type="text" name="s" placeholder="Resim Urlsi" required>
<input type="button" onclick="addc();" value="Çek" />
</form>
<p id="scss"></p>
bot.php
<?php
$dosya= $_POST['s'];
function Curlz($url)
{
$header[0] = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
$header[] = 'Cache-Control: max-age=0';
$header[] = 'Connection: keep-alive';
$header[] = 'Keep-Alive: 300';
$header[] = 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7';
$header[] = 'Accept-Language: en-us,en;q=0.5';
$header[] = 'Pragma:';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com/');
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($curl);
curl_close($curl);
return $body;
}
$resimKlasorum = 'tmp/';
function resimIndir($resim){
global $resimKlasorum;
global $dosya;
global $imgjpg;
$imageal = Curlz("$dosya");
//Getden yada posttan gelen img urlsi
file_put_contents("tmp/$imgjpg", $imageal);
}
$dppart = pathinfo("$dosya");
$dpfn= $dppart['filename'];
$rid = uniqid();
$sid = md5($rid);
$imgjpg = $dppart['basename'];
resimIndir($dosya);
require 'class.upload.php';
$handle = new Upload( "tmp/$imgjpg");
if ( $handle->uploaded ) {
$handle->file_new_name_body = "$sid";
$handle->image_convert = 'png';
$handle->file_new_name_ext = 'png';
$handle->png_compression = 6;
$handle->image_resize = true;
$handle->image_x = 1024;
$handle->image_y = 768;
$handle->Process("images");
if ( $handle->processed ){
$rsm = $handle->file_dst_name;
echo "<img src=\"images/$rsm\">";
unlink("tmp/$imgjpg");
}
}
resimleri düzenlemekte kullandığımız kendi alanının en iyisi
class.upload.php