Automatically Resizing a Logo for Rotation

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
User avatar
Matthew G. Saroff
Registered User
Posts: 57
Joined: Fri May 09, 2014 8:48 pm
Name: Matthew G. Saroff

Automatically Resizing a Logo for Rotation

Post by Matthew G. Saroff »

At our board, we have 20 or so forum logos, and we rotate them through a cron job.

In phpBB 3.0.x, I could rotate through the images and accommodate their different sizes (generally from 100 to 300 pixels) by simply not specifying the image size, and it would resize automatically.

In /styles/prosilver/imageset/imageset.cfg, I would just do this:

Code: Select all

img_site_logo = site_logo.jpg
I've updated 3.2.2, and I did the edit to /styles/prosilver/theme/colours.css from:

Code: Select all

.site_logo {
background-image: url("./images/site_logo.gif");
}
To:

Code: Select all

.site_logo {
background-image: url("./images/site_logo.jpg");
}
Unfortunately, I haven't figured out a way to resize to accommodate the different sizes of images.

Right now, in /styles/prosilver/theme/common.css, I have put in something that is roughly the size of the larger rotating logos:

Code: Select all

.site_logo {
        display: inline-block;
        width: 250px;
        height: 175px;a*/
}
For most of the logos, we get something like this:
Image
(don't judge us)

I can read the size of the image using the following php code:

Code: Select all

<?php
        $zzsize = getimagesize("/home/stellarp/www/phpBB3/styles/prosilver/theme/images/site_logo.jpg");
        $zzw = $zzsize[0];
        $zzh = $zzsize[1];

?>
But I cannot figure out how to pass that into /styles/prosilver/theme/common.css, which would automatically resize when the logos change.
--
The Dream involves 4 sets of identical twins, 2 gallons of Cool Whip, 5 quarts of chocolate syrup, 2-1/4 pounds of strawberries, satin sheets, a magnum of champagne, a trapeze, and a python.

I wrote BBCodeWebex for Firefox which automates the addition of html and bbcode tags on blogs and discussion boards.

Eventually, I'll port it to Chromium browsers.
User avatar
janus_zonstraal
Registered User
Posts: 6414
Joined: Sat Aug 30, 2014 1:30 pm

Re: Automatically Resizing a Logo for Rotation

Post by janus_zonstraal »

Try to add

Code: Select all

background-repeat: no-repeat;
in your

Code: Select all

/styles/prosilver/theme/common.css
Sorry! My English is bat ;) !!!
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Automatically Resizing a Logo for Rotation

Post by david63 »

Matthew G. Saroff wrote: Sat Jun 23, 2018 2:08 am But I cannot figure out how to pass that into /styles/prosilver/theme/common.css, which would automatically resize when the logos change.
Have you tried using jQuery? There are functions in jQuery that will allow you to manipulate css data
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
Matthew G. Saroff
Registered User
Posts: 57
Joined: Fri May 09, 2014 8:48 pm
Name: Matthew G. Saroff

Re: Automatically Resizing a Logo for Rotation

Post by Matthew G. Saroff »

janus_zonstraal wrote: Sat Jun 23, 2018 7:30 am Try to add

Code: Select all

background-repeat: no-repeat;
in your

Code: Select all

/styles/prosilver/theme/common.css
Perfect:
Image
--
The Dream involves 4 sets of identical twins, 2 gallons of Cool Whip, 5 quarts of chocolate syrup, 2-1/4 pounds of strawberries, satin sheets, a magnum of champagne, a trapeze, and a python.

I wrote BBCodeWebex for Firefox which automates the addition of html and bbcode tags on blogs and discussion boards.

Eventually, I'll port it to Chromium browsers.
Post Reply

Return to “phpBB Custom Coding”