(03-04-26, 06:59 PM)nnnjk كتب : بعد تطبيق الكود الاخير ظهر خطأ
Parse error: syntax error, unexpected ';' in /home/username/domains/alshafeen.site/public_html/vb/y2kswimgcache.php on line 78
مركب سكربت بسيط لرفع الملفات
ينقل الصور جميعها حتى من صحيفة الرياض
جرب
http://alshafeen.site/uploads.php
بعد تطبيق الكود الاخير ظهر خطأ
Parse error: syntax error, unexpected ';' in /home/username/domains/alshafeen.site/public_html/vb/y2kswimgcache.php on line 78
مركب سكربت بسيط لرفع الملفات
ينقل الصور جميعها حتى من صحيفة الرياض
جرب
http://alshafeen.site/uploads.php
مركب فيه هذا الكود فقط
PHP كود :$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
(04-04-26, 05:42 PM)nnnjk كتب : اضافة الى ماسبق يبدوا ان دالة سحب الملف ودالة ختم الصور لهما الدور الاساسي في النقل
هذا كود سكربت بسيط لسحب الملفات من رابط يسحب جميع الصور ويختمها سوا من صحيفة المرصد او صحيفة الرياض او خبرني لاكن لاينقل الصور من موقع ويكيبيديا
<?php
function watermark($name, $ext, $logo){
if (preg_match("/jpg|jpeg/",$ext)){$src_img=imagecreatefromjpeg($name);}
if (preg_match("/webp/",$ext)){$src_img=imagecreatefromwebp($name);}
if (preg_match("/png/",$ext)){$src_img=imagecreatefrompng($name);}
if (preg_match("/gif/",$ext)){$src_img=imagecreatefromgif($name);}
$src_logo = imagecreatefrompng($logo);
$bwidth = imageSX($src_img);
$bheight = imageSY($src_img);
$lwidth = imageSX($src_logo);
$lheight = imageSY($src_logo);
//fix bug for 1beta3
if ( $bwidth > 160 && $bheight > 130 ) {
$src_x = $bwidth - ($lwidth + 5);
$src_y = $bheight - ($lheight + 5);
ImageAlphaBlending($src_img, true);
ImageCopy($src_img,$src_logo,$src_x,$src_y,0,0,$lwidth,$lheight);
if (preg_match("/jpg|jpeg/",$ext)){imagejpeg($src_img, $name);}
if (preg_match("/png/",$ext)){imagepng($src_img, $name);}
if (preg_match("/webp/",$ext)){imagewebp($src_img, $name);}
if (preg_match("/gif/",$ext)){imagegif($src_img, $name);}
}# < 150
else
{
return false;
}
}
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
//blog.theonlytutorials.com
//author: agurchand
$memory_limit='128M';
$max_execution_time='300';
if($_POST){
//get the url
$url = $_POST['url'];
//add time to the current filename
$name = basename($url);
list($txt, $ext) = explode(".", $name);
$name = time();
$name = $name.".".$ext;
$ext=".jpg".$ext;
// $ext = end($sepext);
/*$t=array('jpg' , 'png' , 'gif','ip' , 'rar');
if(!in_array($ext,$t))
{ echo gggg;}else {
*/
//here is the actual code to get the file from the url and save it to the uploads folder
//get the file from the url using file_get_contents and put it into the folder using file_put_contents
$upload = file_put_contents("uploads/$name",file_get_contents($url,false,$context));
$fileplace="uploads";
@watermark($fileplace."/".$name,$ext,'logo/logo.png');
//include('Thumbnail.class.php');
// $thumb=new Thumbnail("$name");
// $thumb->quality='100';
// $thumb->process();
// generate image
// $thumb->save("$name");
$filesk= "$name";
//$name = str_replace("?format=jpg","gg",$filesk);
echo $TXTREM ;
//check success
if($upload)
echo "Success:$name <a href='uploads/".$name."' target='_blank'>Check Uploaded</a>"; else "please check your folder permission";
}
//}
?>
<html>
<head><title>Theonlytutorials - Simple File Upload from URL Script!</title></head>
<body>
<h3>Theonlytutorials.com - Very Simple File Upload from URL Script!</h3>
<form action="" method="post">
Your URL: <input type="text" name="url" />
<input type="submit" value="upload Images" name="upload"/>
</form>
</body>
</html>
الله يعطيك العافيه على المجهود
ختم الصوره لاكن ظهرت سوداء ليس فيها محتوى
ممكن مساعده بعد استخدام السكربت وسحب الصوره نوع jpg من صحيفة الرياض خرج لي الخطأ التالي
PHP كود :
Warning: file_get_contents(https://www.alriyadh.com/media/thumb/11/4c/830_0b6a196952.jpg): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/username/domains/alshafeen.site/public_html/uploads.php on line 84
وجدت هذا الحل لاكني لم افهمه
126
[/url]https://stackoverflow.com/questions/697472/php-file-get-contents-returns-failed-to-open-stream-http-request-failed
Try u cURL.
Copy
كود :
<?php
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,'http://###.##.##.##/mp/get?mpsrc=http://mybucket.s3.amazonaws.com/11111.mpg&mpaction=convert format=flv');
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Your application name');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
?>[url=https://stackoverflow.com/a/697540]Share
