Needs review
Project:
Rotating Banner
Version:
7.x-7.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Feb 2011 at 02:59 UTC
Updated:
11 Jun 2012 at 18:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
AimAdvantage commentedThanks Jacob,
Does this still enable the text to be linked to a URL?
Thanks for keeping up on this module as it is clearly the easiest solution for a non-flash rotating banner in Drupal and can still be styled fairly easily with CSS.
Aaron
http://www.aimadvantage.com
Comment #2
james.elliott commentedI don't think this patch will work. You're initializing $smallest as 0 and then only updating it if the filesize is less or the variable is NULL. That means that $smallest will never change for the initialized 0 unless you have a file with a negative size.
Comment #3
JacobSingh commentedIf you have no file at all, the $smallest var will not be initialized, so there will be a PHP notice. You have to set it to something.
Comment #4
JacobSingh commentedI also added a conditional below to not include a size if $smallest is 0.
Comment #5
james.elliott commentedYou're also initializing the variables at the beginning of the foreach() loop. That means that rather than being storage for whichever slide meets the criteria to overwrite those values, they're getting thrown out at each iteration so that the last slide in the banner will always be the smallest and tallest.
I think the real problem is that when there is no file, we still try to calculate the width/height ratio. I think that is where the div by 0 error is coming from. I've attached a patch to that effect.
Comment #6
JacobSingh commentedHey, $smallest is undefined (even outside the loop). So if there are no files in the banner, it will still throw a notice.
Comment #7
james.elliott commentedI've tested this a bunch of times and I'm not getting any div by 0 notices when viewing the rotating banner. I am however, getting 18 warnings and notices on the block config page.
https://skitch.com/jameselliott/rqss6/rotating-banner-my-banner-block-d7...
Comment #8
JacobSingh commentedsorry, didn't see that $smallest was defined.
Comment #9
james.elliott commentedCommitted
Comment #11
Mark Linden commentedCould not get this working under 7.x-7.x-dev or 7.x-2.x-dev.
It still requires an image to be assigned when creating a new banner.