Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Images not loading #595

Closed
dur41d opened this issue Nov 17, 2018 · 17 comments
Closed

Images not loading #595

dur41d opened this issue Nov 17, 2018 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@dur41d
Copy link
Contributor

dur41d commented Nov 17, 2018

Bug Report

When uploading images (or files) via the admin interface the images don't load and the broken image icon appears. I checked the url being requested and the port is wrong. Here is an example:

https://maakom.nfshost.com:80/directus/public/uploads/_/originals/(Solaris).jpg

port (80) with https does not work. When 80 is removed the image is loaded correctly.

Steps to Reproduce

  1. Upload an image to a collection that has a file type.
  2. See broken image icon.

Technical Details

  • Device: Desktop
  • OS: Windows 10.1803
  • Browser: Chrome 70.0.3538
  • Directus suite: 7.0.7
  • Install Method: cloned master branch
@rijkvanzanten
Copy link
Member

I think this might be related to
#589

@rijkvanzanten rijkvanzanten transferred this issue from another repository Nov 17, 2018
@rijkvanzanten
Copy link
Member

@wellingguzman this wrong url is returned by the api

@benhaynes benhaynes added the bug Something isn't working label Nov 18, 2018
@benhaynes benhaynes added this to Needs triage in Bug Triage via automation Nov 18, 2018
@benhaynes benhaynes added this to To do in v2.0.9 via automation Nov 18, 2018
@AntiCZ
Copy link
Contributor

AntiCZ commented Nov 19, 2018

@dur41d Hi, can you provide your config with the storage area? I am not a contributor but also develop under https on a subdomain. I am working on the file uploading right now and this is really interesting to me.

@wellingguzman
Copy link
Contributor

Hey @dur41d is Directus behind a proxy?

@dur41d
Copy link
Contributor Author

dur41d commented Nov 21, 2018

Hi @AntiCZ. My config is the default one. i didn't change anything except for the paths.

'storage' => [
'adapter' => 'local',
'root' => '../uploads//originals',
'root_url' => '/uploads/
/originals',
'thumb_root' => '../uploads/_/thumbnails',
],

@dur41d
Copy link
Contributor Author

dur41d commented Nov 21, 2018

Hi @wellingguzman .. i don't know but I don't think so.. I'm using a shared host. How can I find out?

@wellingguzman wellingguzman moved this from Needs triage to High priority in Bug Triage Nov 21, 2018
@makote
Copy link

makote commented Nov 23, 2018

I have the same problem running on webfaction shared, image links add the trialing port to the url: ":80" before the slug.

@makote
Copy link

makote commented Nov 23, 2018

Confirming #589 fixes this.

@dur41d
Copy link
Contributor Author

dur41d commented Nov 23, 2018

A question: isn't it better to leave the link without a scheme to avoid all scheme problems like:

//domain.com/image.jpg

@wellingguzman
Copy link
Contributor

Thanks @makote, I will merge that PR in order to fix this issue.

@dur41d the API returns both full url and path, but as the app might not be able to figure out where the host of that image is, we provide the full path as well. Can you also confirm that the fix on #584 also works for you?

@dur41d
Copy link
Contributor Author

dur41d commented Nov 23, 2018

@wellingguzman How do i test fix? I'm using the latest from directus master branch. I'm not using the api project.

I understand that the API is returning the path but I'm suggesting that it returns it without a scheme to avoid scheme related problems like this one.

@wellingguzman
Copy link
Contributor

@wellingguzman How do i test fix? I'm using the latest from directus master branch. I'm not using the api project.

You can manually update those changes reflected in the PR https://github.com/directus/api/pull/589/files (look at the new lines)

I understand that the API is returning the path but I'm suggesting that it returns it without a scheme to avoid scheme related problems like this one.

The API return the url without the scheme or host, only the path, but the app uses the full url to make sure it uses the proper url (the app can be in different host from the api)

This should be fixed in the API, as the #589 tries to do, if you can confirm this is also working for you, I will merge it and will be released on the next Directus version.

@dur41d
Copy link
Contributor Author

dur41d commented Nov 26, 2018

@wellingguzman I tested the fix and I confirm that it works.

@wellingguzman
Copy link
Contributor

Awesome! Thanks @Anthonyzou, @makote and @dur41d.

Bug Triage automation moved this from High priority to Closed Nov 26, 2018
@wellingguzman wellingguzman added this to Done in v2.0.10 Nov 26, 2018
@wellingguzman
Copy link
Contributor

This ticket has been fixed by d91c0d0

samvasko pushed a commit to samvasko/api that referenced this issue Nov 25, 2019
@dataexcess
Copy link

I also have this issue...
None of the images are previewing anywhere on the Directus app. Not in my collection list preview thumbnails (there's simply a default image icon), not in the collection items themselves... there is a "(i) not found" error displayed on the preview. Also not in the File library... there are just 'JPG' labels rendered instead of the images themselves.

There's no error whatsoever when uploading or choosing images however... it's really only the previewing inside the app that is broken. I also made the 'read' of the directus_files enabled inside the Roles&Permissions Public settings..

What am I doing wrong?

@dataexcess
Copy link

Ok I just figured out the following:

I'm using Directus for two separate projects (and hence servers).
One is using Ubuntu and I could install directus without any issue.
The other is Debian 10 (not officially supported) and I could not install directus directly.
Instead I had to install the sharp image processing library manually, in order to get directus installed.

I guess this means this bug is related to sharp and Debian 10.

Also this bug only appears when using jpegs, with pngs everything works fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Bug Triage
  
Closed
v2.0.10
  
Done
v2.0.9
  
To do
Development

No branches or pull requests

7 participants