Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "shadercloud/laravel-thumbnail",
"name": "rolandstarke/laravel-thumbnail",
"description": "Laravel Thumbnail generator",
"keywords": ["laravel", "image", "thumbnail"],
"license": "MIT",
Expand Down
17 changes: 16 additions & 1 deletion src/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,22 @@ public function getImage(): string
if ($this->disk) {
return Storage::disk($this->disk)->get($this->path);
} else {
$content = file_get_contents($this->path);
$url = $this->path;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_HEADER , false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST , false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION , true);
curl_setopt($ch, CURLOPT_AUTOREFERER , true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12');
$content = curl_exec($ch);
curl_close($ch);



if ($content === false) {
throw new Exception('Could not get file content for path "' . $this->path . '"');
}
Expand Down