2016-07-04 2 views

Antwort

0

Verwaltet, um es zu lösen, indem Sie den Fotopfad als Zeichenfolge angeben.

Wenn jemand interessiert ist, wie es wie

$url = 'http://url.to/picture'; 
$path = 'uploads/pictures'; 
$name = md5(str_random(10)) . '.jpg'; 
$filePath = public_path($path . '/' . $name); 
$file = fopen($filePath, 'w'); 

$options = [ 
    CURLOPT_FILE => $file, 
    CURLOPT_TIMEOUT => 60, 
    CURLOPT_URL  => $url, 
]; 

$ch = curl_init(); 
curl_setopt_array($ch, $options); 
curl_exec($ch); 
curl_close($ch); 
fclose($file); 

Picture::create(['image' => $filePath]); 
sieht
Verwandte Themen