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: 42
Joined: Fri May 09, 2014 8:48 pm
Name: Matthew G. Saroff

Automatically Resizing a Logo for Rotation

Post by Matthew G. Saroff » Sat Jun 23, 2018 2:08 am

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.

janus_zonstraal
Registered User
Posts: 2782
Joined: Sat Aug 30, 2014 1:30 pm

Re: Automatically Resizing a Logo for Rotation

Post by janus_zonstraal » 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
Sorry! My English is bat ;) !!!

User avatar
david63
Jr. Extension Validator
Posts: 15061
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Automatically Resizing a Logo for Rotation

Post by david63 » Sat Jun 23, 2018 7:32 am

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!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Matthew G. Saroff
Registered User
Posts: 42
Joined: Fri May 09, 2014 8:48 pm
Name: Matthew G. Saroff

Re: Automatically Resizing a Logo for Rotation

Post by Matthew G. Saroff » Sun Jun 24, 2018 12:25 am

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.

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 6 guests