Advertisement Management

Responsive Banners - Advertisement Management

Re: Responsive Banners

by CGI1984 » Sat May 16, 2020 12:26 am

Thanks. Understood. I see what you mean. I’m using the code exactly as you gave it to me though. Is there perhaps anything missing on my end from the code that might cause it to show on the site?

But it’s working. It isn’t acting as text. It’s acting as code and getting rid of all the gaps and margins.

When you did the preview you didn’t see it?
User avatar
CGI1984
Registered User
Posts: 203
Joined: Thu Feb 20, 2020 8:27 am

Re: Responsive Banners

by DavidIQ » Sat May 16, 2020 12:33 am

Nope. Your board's not live?
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 18489
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón

Re: Responsive Banners

by CGI1984 » Sat May 16, 2020 12:44 am

Sorry, not at the moment. But I’ll play with it a bit more. Maybe I’ll be able to figure it out. Is there perhaps something else the style needs to be wrapped in? Like Head or something like that perhaps?
User avatar
CGI1984
Registered User
Posts: 203
Joined: Thu Feb 20, 2020 8:27 am

Re: Responsive Banners

by CGI1984 » Sat May 16, 2020 12:48 am

Got it. Needed to be <style= and not <style>
User avatar
CGI1984
Registered User
Posts: 203
Joined: Thu Feb 20, 2020 8:27 am

Re: Responsive Banners

by skybound » Thu Jun 04, 2020 6:38 pm

This is how we implemented responsive banners. Just placed this into the code section of the advert:

Code: Select all

<A href="http://www.xyz.com/"{COUNT_CLICK}>
<picture>
    <source media="(min-width: 1400px)" srcset="adimage/980Advert.png">
    <source media="(min-width: 800px)" srcset="adimage/728Advert.png">
    <source media="(min-width: 400px)" srcset="adimage/400Advert.png">
    <img src="adimage/728Advert.png" alt="IfItDoesntMatchAnyMedia">
</picture>
It does mean you need at least 3 versions of the banner artwork - but is an easy implementation.
skybound
Registered User
Posts: 201
Joined: Wed Nov 12, 2003 7:11 am
Location: Port Elizabeth - South Africa

Re: Responsive Banners

by ManOnTime » Thu Jun 11, 2020 6:29 pm

I combined some of the code in this thread for use on my site, but I am still having display issues.

How can we totally eliminate the grey space around the ad? Also, why doesn't it center in the box on mobile? (See screen shots.)

My site: https://www.manontime.com

Code I am using:

Code: Select all

<style=
.ad_banner {
  margin: 0;
  padding: 0;
  border: 0;
  }
</style>

<div class="ad_banner">
<A href="https://www.riveredgejewelers.com/" target="_blank"{COUNT_CLICK}>
<picture>
    <source media="(min-width: 1400px)" srcset="https://www.manontime.com/banners/980Advert.png"alt="River Edge Jewelers" width="100%">
    <source media="(min-width: 800px)" srcset="https://www.manontime.com/banners/728Advert.png"alt="River Edge Jewelers" width="100%">
    <source media="(min-width: 400px)" srcset="https://www.manontime.com/banners/400Advert.png"alt="River Edge Jewelers" width="100%">
    <img src="https://www.manontime.com/banners/980Advert.png"alt="River Edge Jewelers" width="100%">
</picture>
</div>
Desktop:
desktop.jpg
Mobile:
Screenshot_20200611-132532_Chrome.jpg
Thank you.
ManOnTime
Registered User
Posts: 2
Joined: Fri Dec 21, 2018 8:16 pm
Name: Matt

Re: Responsive Banners

by CGI1984 » Wed Jun 24, 2020 7:46 pm

skybound wrote:This is how we implemented responsive banners. Just placed this into the code section of the advert:

Code: Select all

<A href="http://www.xyz.com/"{COUNT_CLICK}>
<picture>
    <source media="(min-width: 1400px)" srcset="adimage/980Advert.png">
    <source media="(min-width: 800px)" srcset="adimage/728Advert.png">
    <source media="(min-width: 400px)" srcset="adimage/400Advert.png">
    <img src="adimage/728Advert.png" alt="IfItDoesntMatchAnyMedia">
</picture>
It does mean you need at least 3 versions of the banner artwork - but is an easy implementation.
Thank you for this.

So if I understand you correctly, I would need to create one ad banner each at 1400px, 800px, and 400px? - Yes, that would be very easy.

The code part has me a bit confused though.

At the moment we are using the following:

Code: Select all

<style=
.my_ad_banner {
  margin: 0;
  padding: 0;
  border: none;
  display: block;
}
</style>
<div class="my_ad_banner">
<a href="https://ad-link-here.com"><img src="https://our-site.com/images/phpbb_ads/xxxxxxxxxxxx.jpg" width="100%"/></a>
</div>
So we would need to implement this code instead as follows?

Code: Select all

<style=
.my_ad_banner {
  margin: 0;
  padding: 0;
  border: none;
  display: block;
}
</style>
<div class="my_ad_banner">
<A href="https://ad-link-here.com"{COUNT_CLICK}>
<picture>
    <source media="(min-width: 1400px)" srcset="adimage/980Advert.png">
    <source media="(min-width: 800px)" srcset="adimage/728Advert.png">
    <source media="(min-width: 400px)" srcset="adimage/400Advert.png">
    <img src="adimage/728Advert.png" alt="IfItDoesntMatchAnyMedia">
</picture>
And then we would need to upload the 3 ad banner files to https://our-site.com/images/phpbb_ads/ and title them 980Advert.png, 728Advert.png, and 400Advert.png?

Lastly, I am not sure what the advantage is of having the 3 different sized banner files because the width="100%" code we are using now automatically resizes the single 1400px file to fit any screen width resolution. Are there any other advantages to having the 3 different banner sizes?

The only problem we have right now is that on a mobile device the ads don't actually show 100% edge to edge on the mobile device screen when running our site using the mobile responsive version of the style we are using.

As it is now, the ads only fill up about 90% of the screen width. We tried playing around with different width percentages and the problem is the same. We can't seem to fix it with code.

If we could figure out how to get the ads on mobile devices to stretch edge to edge to 100% on the screen like the rest of the site does on a mobile device in our responsive style then we would be really happy with the way our ads are displaying now. Is there perhaps any way to get the ads to stretch to 100% of the screen on a mobile device instead of only around 90%?

Many thanks again.
User avatar
CGI1984
Registered User
Posts: 203
Joined: Thu Feb 20, 2020 8:27 am

Re: Responsive Banners

by CGI1984 » Thu Jun 25, 2020 10:33 am

ManOnTime wrote:I combined some of the code in this thread for use on my site, but I am still having display issues.

How can we totally eliminate the grey space around the ad? Also, why doesn't it center in the box on mobile? (See screen shots.)

My site: https://www.manontime.com

Thank you.
I had a quick look at your site.

The grey space is part of the framing layout of your site's Style when you have blank area. What color would you expect it to be when you have so much empty space around the small PNG file?

Yes, I see it is not centered on mobile. It is in the middle, but it is top justified. I am not sure if this will work, but try changing the code to:

Code: Select all

margin: 0;
  padding: 0;
  border: none;
  display: block;
Also, in the Ad Management setting s for the ad make sure you have the following enabled to "Yes":
Center this ad automatically:
Set to yes to let this extension center your ad automatically. If this leads to undesired results, use CSS directly in the code to center your ad accordingly.
I just tried this whole thing on our site with the 3 different banner sizes. I didn't see any benefit. The ads still don't load edge to edge on a mobile. I only get about 90%-95% edge to edge, same as before. Also, I can't get the largest sized banner to load on a 1920x1080 screen. I tried changing min-width to 1920px, but it didn't change anything.

So for now I am back to using just one 1700px banner with the width="100%" setting, which loads correctly for all screen sizes.
User avatar
CGI1984
Registered User
Posts: 203
Joined: Thu Feb 20, 2020 8:27 am

Re: Responsive Banners

by skybound » Fri Jun 26, 2020 6:51 am

CGI1984 wrote:
skybound wrote:This is how we implemented responsive banners. Just placed this into the code section of the advert:

Code: Select all

<A href="http://www.xyz.com/"{COUNT_CLICK}>
<picture>
    <source media="(min-width: 1400px)" srcset="adimage/980Advert.png">
    <source media="(min-width: 800px)" srcset="adimage/728Advert.png">
    <source media="(min-width: 400px)" srcset="adimage/400Advert.png">
    <img src="adimage/728Advert.png" alt="IfItDoesntMatchAnyMedia">
</picture>
It does mean you need at least 3 versions of the banner artwork - but is an easy implementation.
Thank you for this.

So if I understand you correctly, I would need to create one ad banner each at 1400px, 800px, and 400px? - Yes, that would be very easy.

The code part has me a bit confused though.

At the moment we are using the following:

Code: Select all

<style=
.my_ad_banner {
  margin: 0;
  padding: 0;
  border: none;
  display: block;
}
</style>
<div class="my_ad_banner">
<a href="https://ad-link-here.com"><img src="https://our-site.com/images/phpbb_ads/xxxxxxxxxxxx.jpg" width="100%"/></a>
</div>
So we would need to implement this code instead as follows?

Code: Select all

<style=
.my_ad_banner {
  margin: 0;
  padding: 0;
  border: none;
  display: block;
}
</style>
<div class="my_ad_banner">
<A href="https://ad-link-here.com"{COUNT_CLICK}>
<picture>
    <source media="(min-width: 1400px)" srcset="adimage/980Advert.png">
    <source media="(min-width: 800px)" srcset="adimage/728Advert.png">
    <source media="(min-width: 400px)" srcset="adimage/400Advert.png">
    <img src="adimage/728Advert.png" alt="IfItDoesntMatchAnyMedia">
</picture>
And then we would need to upload the 3 ad banner files to https://our-site.com/images/phpbb_ads/ and title them 980Advert.png, 728Advert.png, and 400Advert.png?

Lastly, I am not sure what the advantage is of having the 3 different sized banner files because the width="100%" code we are using now automatically resizes the single 1400px file to fit any screen width resolution. Are there any other advantages to having the 3 different banner sizes?

The only problem we have right now is that on a mobile device the ads don't actually show 100% edge to edge on the mobile device screen when running our site using the mobile responsive version of the style we are using.

As it is now, the ads only fill up about 90% of the screen width. We tried playing around with different width percentages and the problem is the same. We can't seem to fix it with code.

If we could figure out how to get the ads on mobile devices to stretch edge to edge to 100% on the screen like the rest of the site does on a mobile device in our responsive style then we would be really happy with the way our ads are displaying now. Is there perhaps any way to get the ads to stretch to 100% of the screen on a mobile device instead of only around 90%?

Many thanks again.
Our implementation only requires what was in my post and not the rest of the code. That is another implementation. Don't use both implementations together.

The advantage of have 3 differing banner sizes is to ensure you make the best use of the platform you are serving to as opposed to just scaling a single graphic.
skybound
Registered User
Posts: 201
Joined: Wed Nov 12, 2003 7:11 am
Location: Port Elizabeth - South Africa

Re: Responsive Banners

by CGI1984 » Fri Jun 26, 2020 11:40 am

@skybound - Thanks.

I tried the code exactly as you have it. For some reason it makes the space for the ad on our site, but doesn't load the ad on our site when on a desktop computer.

On a mobile device it loads the add at full size and it goes way beyond the bounding area of the responsive mobile style. This was the same problem we had before on mobile devices and why we implemented width="100%"

The only issue I was hoping to rectify was to be able to get my ads to stretch to 100% on a mobile device instead of only 90%-95%, but this doesn't appear to be a solution, so we are back to what we were using before, which works fine in every other way. Why though width="100%" only gives me 90%-95% on a mobile device still remains a mystery.
User avatar
CGI1984
Registered User
Posts: 203
Joined: Thu Feb 20, 2020 8:27 am

Re: Responsive Banners

by #larsneo » Fri Jun 26, 2020 4:39 pm

if using the 'centered' option there's a css-class around the image and one can use css-magic like
.phpbb-ads-center img {
width: 100%;
max-width: 728px;
height: auto;
max-height: 90px;
}
if using e.g. leaderboard size (change size for other bannerformats). see it in action at nuforum
#larsneo
Registered User
Posts: 3
Joined: Fri Jun 26, 2020 4:15 pm

Re: Responsive Banners

by CGI1984 » Sat Aug 08, 2020 12:30 pm

I am trying to get my ads to open in new tab or window. I have added target="_blank" to the URL link, but it isn't working, any ideas please if thee is another way perhaps?
User avatar
CGI1984
Registered User
Posts: 203
Joined: Thu Feb 20, 2020 8:27 am

Re: Responsive Banners

by hdkcreative » Tue Apr 04, 2023 3:08 pm

Our Solution :

add this css code in /styles/prosilver/theme/stylesheet.css

Code: Select all

.responsiveX {
	max-width: 100%;
	height: auto;
  }
add this in you Advertisement settings zone code

Code: Select all

<div>
  <a href="https://www.YOURSITE.com/" target="_blank">
    <img class="responsiveX" src="https://PATH_TO_YOUR_IMAGE.jpg" >
  </a>
</div>
Image

and this is ALL !
hdkcreative
Registered User
Posts: 2
Joined: Tue Apr 04, 2023 3:02 pm

Re: Responsive Banners

by Times Enemy » Thu Feb 29, 2024 7:16 pm

CGI1984 wrote:UPDATE:I think I got it. I added the following to the end of the banner URL and this fixed it: alt="Image" width="100%"/>.
It is now 2024 and this update still works! That is also to say that it is 2024 and this issue still exists.
User avatar
Times Enemy
Registered User
Posts: 46
Joined: Thu Aug 11, 2022 9:43 pm

Re: Responsive Banners

by LovelyDai » Thu Jun 27, 2024 6:13 am

Hi

I'm reading these posts and not getting it into my head"!

I have an image whch is linked to a googledoc when clicked.That works. I can centre the image. I've tried and tried but can;t make the image resposive to mobile screens. ANy ideas?
LovelyDai
Registered User
Posts: 8
Joined: Tue Mar 07, 2023 8:12 pm