With the image module you can define a default image that will be displayed if the content editor doesn't upload a different file.
However, this functionality is not visible on the edit form. Here the content editor only sees that there is "No image selected" - and will be confused to find an image displayed with the content after saving, with no idea where the image comes from and how it could be removed (or replaced).

A solution could be to display the default image in the same way as an image uploaded with the field would be, together a help text that this image will be displayed by default - unless a different on is uploaded with this image field.

Comments

swentel’s picture

Category: Bug report » Feature request
davidburns’s picture

swentel’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2143653-3.patch, failed testing.

swentel’s picture

Title: Show default image on the node edit form » Show default image on image field

Better title

swentel’s picture

Status: Needs work » Needs review
StatusFileSize
new3.01 KB
new2.13 KB

Fix tests + additional tests.

tstoeckler’s picture

StatusFileSize
new2.31 KB
new3.38 KB

Replaced entity_load() calls with File::load().

I was about to mark this RTBC (because the above doesn't count), but then something in the behavior threw me a bit off: The default image is displayed to the right of the upload form element, but when an image has been uploaded that is displayed to the left of the form element. (See the attached screenshots, also.) Is that intended?

tstoeckler’s picture

Oops, here are the mentioned screenshots.

swentel’s picture

Ha, hmm interesting. That's a bit weird indeed.
I'm also wondering whether we should add some guiding text to tell the user that this is a default image ?

tstoeckler’s picture

Issue tags: +Needs usability review

Hmm.. good question. I would say "Yes" but I can't really imagine how that would look. I already find the file name and size to be rather distracting, TBH.

swentel’s picture

So it's just a matter of adding a weight to align it to the left.
(-10 is my lucky number)

ifrik’s picture

Thanks, the patch works for me, and has the required functionality.

The image on the left looks good, but... now there is a bit weird swapping positions going on when an image does get chosen, because then the file name is to the left (as in screenshot #8).
My preference would be also show the chosen image on the left, with the file name and size to the right of it. If only because the images are shown in the same image size in the form, while the length of the file name can vary. But I suppose that's another issue.

An additional line could be "If no file is chosen, the default image will be used."

swentel’s picture

Moved the upload image to the left as well, makes much sense!

ifrik’s picture

Works and looks good.

Thanks!

The last submitted patch, 11: 2143653-11-default-image-widget.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 13: 2143653-13-default-image-widget.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
StatusFileSize
new3.69 KB
new1.31 KB

Cancelled both tests for this patch - small change in comment of test.

ifrik’s picture

Still works as expected, and looks good.

swentel’s picture

ifrik - feel free to RTBC, we'll see what the core committers think :)

ifrik’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!
The patch works as I envisioned it.

alexpott’s picture

I've asked on IRC for wither yoroy or Bojhan to have a look at this wrt to usability.

yoroy’s picture

I think I'm missing something. Simply-testing the patch in #17 doesn't give me an altered image field on the core Article content type. And does the screenshot in #17 even show the default image?

yoroy’s picture

Status: Reviewed & tested by the community » Needs review

Status

swentel’s picture

Yoroy: you need to upload a default image on the image field, so manage fields > article > image
Then go to node/add/article, you should see the image there.

yoroy’s picture

Status: Needs review » Needs work
StatusFileSize
new32.22 KB
new37.54 KB
new38.18 KB
new51.66 KB
new29.53 KB

Duh! This perpetual noob always expects the CMS to do things automatically :-)

Anyway, the general idea is sound. It makes sense to show a default image on the form when there is one defined.

## Before with a default image defined, no upload

 no default image shown on the upload field

## Before, with a default image defined, with upload

 with an image uploaded

## After, with a default image defined, no upload

## After, with a default image defined, with upload

The only thing that looks strange to me is the file link info put after the alt text. This whole widget still looks wonky overall, and most of this patch improves things already quite a bit but lets keep the thumbnail and the file name/link together:

swentel’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new4.82 KB
new1.43 KB
new38.18 KB

Played with the weights and this was the easiest way to ge a more consistent view. Alt and title are above, just like they used to be, image is on the left.
If this is ok, we can look for follow ups, because the remove button is being a bit annoying here to position right.

yoroy’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs usability review +Usability

Thanks for the updated patch. Seems to me that this issue achieves its intended goal so back to RTBC

#2115469: Image Field style update has the plan for an updated image field styling.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @yoroy - remembered to add you the commit credit - usability reviews definitely deserve at least that :)

Committed f070288 and pushed to 8.0.x. Thanks!

  • alexpott committed f070288 on 8.0.x
    Issue #2143653 by swentel, tstoeckler, yoroy | ifrik: Added Show default...
ifrik’s picture

Thanks once again!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.