-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
image won't load #1275
Comments
Hi I see two different server domain names in your comments are you pulling your images from the same server or is there a problem with your generated path names? |
Hmm nah apparently that's not the issue, was thinking that might have been the issue, but nah its not apparently. I'm on http://uw-blb.test/products Its the same path |
Hi have you run php artisan storage:link?
Dale Marthaller(dmarthaller@shaw.ca)
…----- Original Message -----
From: MyhedinZika <notifications@github.com>
To: spatie/laravel-medialibrary <laravel-medialibrary@noreply.github.com>
Cc: DMarthaller <dmarthaller@shaw.ca>, Comment <comment@noreply.github.com>
Sent: Sat, 20 Oct 2018 11:32:40 -0600 (MDT)
Subject: Re: [spatie/laravel-medialibrary] image won't load (#1275)
Hmm nah apparently that's not the issue, was thinking that might have been the issue, but nah its not apparently.
I'm on http://uw-blb.test/products
Its the same path
products:770 GET http://uw-blb.test/storage/2/AllOrders.PNG 404 (Not Found)
products:731 GET http://uw-blb.test/storage/1/AddStock2.PNG 404 (Not Found)
products:848 GET http://uw-blb.test/storage/4/Ballina.PNG 404 (Not Found)
products:809 GET http://uw-blb.test/storage/3/createVendor.PNG 404 (Not Found)
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#1275 (comment)
|
Yes I have tried that, but unfortunately thats not the problem The "public/storage" directory already exists. |
If you copy the generated IMG url in another browser window can you see the image? If you either have a misgenerated url or a server config (missing link from your public directory to the storage directory issue).
Dale Marthaller(dmarthaller@shaw.ca)
…----- Original Message -----
From: MyhedinZika <notifications@github.com>
To: spatie/laravel-medialibrary <laravel-medialibrary@noreply.github.com>
Cc: DMarthaller <dmarthaller@shaw.ca>, Comment <comment@noreply.github.com>
Sent: Sat, 20 Oct 2018 13:58:47 -0600 (MDT)
Subject: Re: [spatie/laravel-medialibrary] image won't load (#1275)
Yes I have tried that, but unfortunately thats not the problem
The "public/storage" directory already exists.
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#1275 (comment)
|
@MyhedinZika I had a similar situation happen on my site. It wasn't until I read the comment by @Dmarthaller that I realized I might have an issue with my storage link. I decided to double check that the public/storage directory did in fact exist. That's when I noticed it wasn't a symlink but an actual directory. After making a quick backup of my site I removed the 'public/storage' directory and ran |
If you use homestead, you need to use the
You can get more details from laravel/framework#15439 |
Hi there, I've been trying to show the image on view, but I can't seem to get it to work
I get this on console log
GET http://uw-test.test/storage/1/AddStock2.PNG 404 (Not Found)
I've been trying lots of stuff to show the image, but I can't seem to make it work, clearly I must be missing something. Any help is great
This is my controller
$products = Product::select('products.*')
->keywords(request('search'))
->join('categories', 'categories.id', '=', 'products.category_id')
->category(request('category_id'))
->with('media')
->paginate(config('fi.resultsPerPage'));
This is dd of products
LengthAwarePaginator {#698 ▼
#total: 5
#lastPage: 1
#items: Collection {#712 ▼
#items: array:5 [▼
0 => Product {#703 ▶}
1 => Product {#705 ▶}
2 => Product {#702 ▶}
3 => Product {#701 ▶}
4 => Product {#700 ▼
#guarded: array:1 [▶]
#connection: "mysql"
#table: null
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:26 [▶]
#original: array:26 [▶]
#changes: []
#casts: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: array:1 [▼
"media" => Collection {#691 ▼
#items: array:1 [▼
0 => Media {#697 ▼
#guarded: []
#casts: array:3 [▶]
#connection: "mysql"
#table: null
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:15 [▼
"id" => 1
"model_type" => "FI\Modules\Products\Models\Product"
"model_id" => 5
"collection_name" => "products"
"name" => "AddStock2"
"file_name" => "AddStock2.PNG"
"mime_type" => "image/png"
"disk" => "public"
"size" => 64212
"manipulations" => "[]"
"custom_properties" => "{"custom_headers": []}"
"responsive_images" => "[]"
"order_column" => 1
"created_at" => "2018-10-18 20:41:48"
"updated_at" => "2018-10-18 20:41:48"
]
#original: array:15 [▶]
#changes: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: []
#touches: []
+timestamps: true
#hidden: []
#visible: []
#fillable: []
}
]
}
]
#touches: []
+timestamps: true
#hidden: []
#visible: []
#fillable: []
+mediaConversions: []
+mediaCollections: []
#deletePreservingMedia: false
#unAttachedMediaLibraryItems: []
}
]
}
#perPage: "15"
#currentPage: 1
#path: "http://uw-blb.test/products"
#query: []
#fragment: null
#pageName: "page"
}
My model is like this
use Spatie\MediaLibrary\HasMedia\HasMedia;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
class Product extends Model implements HasMedia
{
use Sortable;
use HasMediaTrait;
public function registerMediaCollections()
{
$this->addMediaCollection('products');
This is my ProductCreateController
if ($request->has('attachments')) {
foreach ($request->attachments as $key => $imagen) {
try {
$product->addMedia($request->attachments[$key])->toMediaCollection('products');
} catch (DiskDoesNotExist $e) {
} catch (FileDoesNotExist $e) {
} catch (FileIsTooBig $e) {
}
}
}
The text was updated successfully, but these errors were encountered: