Announcement

#1 2022-01-24 21:18:48

cbiweb
Member
2021-04-04
46

Unable to add a background image

Hello,

I am trying to add a background image.
The image resides in /gallery/images/wood.jpg

I went to Admin > Plugins > LocalFilesEditor > CSS tab

and entered this code:

Code:

body {
 background-image:url("images/wood.jpg");
 background-position:left top;
 background-size:auto;
 background-repeat:repeat;
 background-attachment:scroll;
}

But the background image is not appearing.

Please advise. :)



Environment:
    Piwigo 12.2.0
    Operating system: WINNT
    PHP: 7.4.20 (Show info) [2022-01-24 16:15:15]
    MySQL: 5.5.5-10.5.10-MariaDB [2022-01-24 16:15:15]
    Graphics Library: GD bundled (2.1.0 compatible)
    Cache size N/A   never calculated

Piwigo URL: n/a - local development at this point

Offline

 

#2 2022-01-24 21:48:48

Katryne
Member
2016-12-03
368

Re: Unable to add a background image

Here is what I entered in Local file Editor (my image is repeated) :

Code:

body {background-image: url(/local/css/papier.jpg)!important;}

Maybe the !important before the comma is ...important


http://photos.katrynou.fr/ v.14.1.0 https://album.chauvigne.info/ v.13.8.0
Système d'exploitation: Linux - Hébergeur 1&1-Ionos PHP: 8.0.28 - MySQL: 5.7.38
Bibliothèque graphique: External ImageMagick 6.9.10-23

Offline

 

#3 2022-01-25 01:51:38

cbiweb
Member
2021-04-04
46

Re: Unable to add a background image

Katryne wrote:

Here is what I entered in Local file Editor (my image is repeated) :

Code:

body {background-image: url(/local/css/papier.jpg)!important;}

Maybe the !important before the comma is ...important

But in which directory do I put the image?

My gallery is now online, with no albums yet (https://musicianaire.ca/gallery/). The page background is black, but the URL for the image is /local/css/images/wood.jpg, same path as yours but of course different image name.  The background is not appearing on my page.

Last edited by cbiweb (2022-01-25 01:56:47)

Offline

 

#4 2022-01-25 06:34:30

Katryne
Member
2016-12-03
368

Re: Unable to add a background image

That is how I manage it, on all 3 url of my profile. One site with Bootstrap darkroom, the 2 others with Modus.


http://photos.katrynou.fr/ v.14.1.0 https://album.chauvigne.info/ v.13.8.0
Système d'exploitation: Linux - Hébergeur 1&1-Ionos PHP: 8.0.28 - MySQL: 5.7.38
Bibliothèque graphique: External ImageMagick 6.9.10-23

Offline

 

#5 2022-01-25 20:17:46

cbiweb
Member
2021-04-04
46

Re: Unable to add a background image

Katryne wrote:

That is how I manage it, on all 3 url of my profile. One site with Bootstrap darkroom, the 2 others with Modus.

But in which directory is the actual image?


/local/css/papier.jpg[ is only a reference URL.  If you go to your /local/css directory, you will see there is no image file there.  The image file must be somewhere, but where?

Last edited by cbiweb (2022-01-25 20:18:12)

Offline

 

#6 2022-01-25 21:46:46

erAck
Only trying to help
2015-09-06
2023

Re: Unable to add a background image

Put it in any directory that is reachable within the web server's document root, it can but doesn't have to be within Piwigo's directories, and adapt /local/css/papier.jpg to the actual absolute URL path. You said your image is /gallery/images/wood.jpg so use that. If you do not prefix the path with a / slash (i.e. like you did with images/wood.jpg) then the image is tried to be loaded relative to the CSS file, which is not what you want here. Unless you copy your image to that location..


Running Piwigo at https://erack.net/gallery/

Offline

 

#7 2022-01-26 06:10:17

cbiweb
Member
2021-04-04
46

Re: Unable to add a background image

Thanks erAck, but the problem is that wood.jpg is already in the directory where I want it to be, it has been all along (gallery/images/).  You can view the file directly by going to https://musicianaire.ca/gallery/images/wood.jpg
As you'll see it is very much there.

However, when I put the following code into LocalFilesEditor > CSS, it does not show up on my gallery pages:

Code:

body {
 background-image:url("images/wood.jpg");
 background-position:left top;
 background-size:auto;
 background-repeat:repeat;
 background-attachment:scroll;
}

Whether I use 'images/wood.jpg' or '/images/wood.jpg', it doesn't show up.
'gallery/images/wood.jpg' or '/gallery/images/wood.jpg' doesn't work, either.
Wrapping it in quotes or single quotes doesn't work.
Putting '!important' at the end doesn't work (yes I put it before the semi-colon :) )

I'm baffled.  This is one of the most basic things in Web design, so I can't help thinking there's a magic trick that Piwigo is waiting for me to do, lol.

Last edited by cbiweb (2022-01-26 06:15:24)

Offline

 

#8 2022-01-26 12:19:24

erAck
Only trying to help
2015-09-06
2023

Re: Unable to add a background image

Apparently currently you are using the relative path images/wood.jpg, the _data/combined/vsltb5.css of https://musicianaire.ca/gallery/ has url(/gallery/local/css/themes/default/images/wood.jpg) which of course results in a 404 error. If I change that to url(/gallery/images/wood.jpg) in the Firefox Web Developer Tools Style Editor, I immediately see the expected result.


Running Piwigo at https://erack.net/gallery/

Offline

 

#9 2022-01-26 16:03:05

cbiweb
Member
2021-04-04
46

Re: Unable to add a background image

erAck wrote:

Apparently currently you are using the relative path images/wood.jpg, the _data/combined/vsltb5.css of https://musicianaire.ca/gallery/ has url(/gallery/local/css/themes/default/images/wood.jpg) which of course results in a 404 error. If I change that to url(/gallery/images/wood.jpg) in the Firefox Web Developer Tools Style Editor, I immediately see the expected result.

But you've seen that I tried various versions of the URL in LocalFilesEditor > CSS.  One of those versions was /gallery/images/wood.jpg  - which you recommend.

Am I to assume that LocalFilesEditor > CSS is broken, and I should not use it?  If so, then where should I add the necessary code to make the background show up?

Last edited by cbiweb (2022-01-26 16:03:37)

Offline

 

#10 2022-01-26 17:52:50

erAck
Only trying to help
2015-09-06
2023

Re: Unable to add a background image

Can you please in LocalFiles Editor change it to url(/gallery/images/wood.jpg) and then check in Firefox, More Tools -> Web Developer Tools (Shift+Ctrl+I), Style Editor what is actually resulting? Or if you don't know how just keep it like that and I'll check later.


Running Piwigo at https://erack.net/gallery/

Offline

 

#11 2022-01-26 21:59:45

cbiweb
Member
2021-04-04
46

Re: Unable to add a background image

erAck wrote:

Can you please in LocalFiles Editor change it to url(/gallery/images/wood.jpg)

Done, just as I've done many times before when trying to resolve this issue.

However, it might've been a cache issue, since it now works.  Go figure.....


EDIT: strangely, it still doesn't work in my local development environment.  This is really odd.

Last edited by cbiweb (2022-01-26 22:04:58)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact