craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 626 forks source link

[4.x]: Images are not uploading properly #10937

Closed mauricioarangoosorio closed 2 years ago

mauricioarangoosorio commented 2 years ago

What happened?

Description

When adding an image to en entry, it looks like it has uploaded. But then the preview thumb is empty. And in the Assets manager, there's a record of the entry but when I clicking on the image it shows a black rectangle only.

Screen Shot 2022-04-18 at 7 56 58 AM

Steps to reproduce

  1. Add an image to an entry

Expected behavior

  1. Should see a thumb in the entry page
  2. Should see a preview of the image in the assets manager

Actual behavior

Craft CMS version

Craft Solo 4.0.0-beta.4

PHP version

8.1.3

Operating system and version

Linux 5.10.76-linuxkit

Database type and version

MySQL 8.0.26

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.0-16)

Installed plugins and versions

brandonkelly commented 2 years ago

If you open your browser’s Network tab and reload the page, do you see any failed image requests?

mauricioarangoosorio commented 2 years ago

As soon as I open the 'entries' page, I see this errors (I have a column for thumbs):

GEThttps://slayed.local/office/actions/assets/generate-transform?transformId=311&v=1648075727
[HTTP/2 500 Internal Server Error 1069ms]
Image Transform Error – craft\errors\ImageTransformException
Failed to generate transform with id of 311.

And then inside an entry page I see a similar error.

When I try to add a new image, this is what I get (not sure why PRIMARY_SITE_URL) is there in the middle of the URL:

GET https://slayed.local/office/PRIMARY_SITE_URL/assets/uploads/Default/test-textile-2-4/_171x240_crop_center-center_none/13.jpg
[HTTP/2 404 Not Found 867ms]

And yes, I do see a failed image request:

GET | https://slayed.local/office/actions/assets/generate-transform?transformId=313&v=1648075727
Status 500

Thank for looking into this!!

brandonkelly commented 2 years ago

Those could be related. Sounds like your filesystem’s base URL begins with PRIMARY_SITE_URL.

If you want to set it to an environment variable, it must begin with $, and cannot contain a trailing path afterward (e.g. $PRIMARY_SITE_URL/assets/uploads would not be allowed).

Otherwise you can set it to an alias, which can contain a subpath.

mauricioarangoosorio commented 2 years ago

What is strange is that I have the $ in the filesystem base URL.

Screen Shot 2022-04-18 at 6 47 24 PM

brandonkelly commented 2 years ago

As I said,

If you want to set it to an environment variable, it must begin with $, and cannot contain a trailing path afterward (e.g. $PRIMARY_SITE_URL/assets/uploads would not be allowed).

mauricioarangoosorio commented 2 years ago

Sorry, need to find my glasses at this time of the day. Ok, thanks for the patience explaining this to me. I'll work on it.

brandonkelly commented 2 years ago

Going to close this for now, but let me know if you continue experiencing this issue after fixing the base filesystem URL.

mauricioarangoosorio commented 2 years ago

Brandon, your input solved my issue. Thank you so much!

brandonkelly commented 2 years ago

Glad to hear that!