simple banner management?
|
globo
![]()
Joined: 2005-02-07
Posts: 37 |
Posted: Fri, 2005-10-14 08:55
|
|
Hi, I've been looking for some kind of solution to include banners into some of my albums. The way I plan to do it now is this: Assign special user to Album - The album I want a banner to appear belongs to user affiliate now. Include data into USER_table - I created two extra fields in the mySQL users table. redirect_link - the URL the banner should redirect to and banner_album - the id of the album that the banners are stored in. What I think needs to be done now is to include some PHP into the smarty templates that I'm using Check for banner - fetch the owner of the album and see if there is a banner defined in the users_table. If it is, then get the data from there. Grab banner - grab an image from the banner album randomly and rpint it with the redirect_URL into the template output. Does that sound like a decent way to do it? Maybe someone will make a module out of this someday. globo |
|
| Login or register to post comments |


Posts: 2835
<moved to G2 development>
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 31891
erm, not sure...
my main problems with your approach:
- what's the purpose of a affiliate user?
- why are banner redirect_link and banner_album user attributes?
IMO, banners are not user attributes and there's no need for a banner user.
and i guess i wouldn't use a G2 album to store the banners. I'd store them similarely to the way that the watermark module stores watermarks images.
btw: there's an "ads" module nearly finished. bytenik is the author and it will be quite cool. but i don't think it has banner support.
it replaces randomly thumbs with ads and it adds ads randomly betweeen the album and the photo view as an intermediate step.
Posts: 37
Well the problem i have to solve is this:
On our website we show pictures that are supplied by our affiliates in order to promote their respective site.
Each affiliate wants only their site promoted when their pictures are shown, so that's why the banner is a userattribute since each affiliate owns it's albums.
Does that make more sense to you now?
Posts: 31891
ok, that explains it.
and letting the affilates manage an album in your g2 seems to be a possible approach.
still, adding columns to existing tables etc. is not the way to write modules for g2.
you'd create a new class GalleryAffiliates with attributes redirectLink etc.
@managing banners in g2 albums:
).
not sure if this is a good idea. what about permissions? the banner photos must be publicly viewable such that the users finally see the banners. at the same time, i guess you want to not have the banner album publicly viewable. well, you could hide it (album non-viewable, items viewable = security by obscurity = bad
- what are the advantages of having a banner album?
Posts: 8590
or simply store the data in PluginParameterMap.. (moduleId = your module, itemId = id of user, param name/value = ...)
Posts: 37
@valiant and mindless
OK, I guess altering the tables is old-style.
Sorry, I have no idea what you are talking about. I'm user with some administration skills. It seems that this is well into the programmers world. Could you help me to definde the task I need, so I can put it into the Marketplace?
This thing is CRUCIAL to our website and we are willing to pay a reasonable amount to get this solved.
The affiliates pay us for redirecting traffic. We show their pictures along with their banner. If our visitors like their pics and sign up with their site we get a share of the revenue. That's the way our site pays for hosting etc.
globo
Posts: 31891
as i see it, you want that each banner provider owns an album on your g2. these albums should be viewable by any user.
additionally, you want to show a random or specific banner from any of the banner albums on the top of your gallery (or on other pages of your website).
this sounds a lot like an imageblock / external imageblock instance with specificItem=bannerAlbumId -> the imageblock would show a random banner from the bannerAlbum.
so no special development is necessary.
Posts: 71
I used a similar approach in a few of my recent gallery mods, where i used the "custom thumbnail" as banner for the appropriate gallery. This limits you to one ad per gallery, but if you make a custom field that would be the redirect url, and tie that in with the thumbnail, it would just be a simple them based change.
This would also allow the album user to have control of the link and the ad image.
Hope that helps
-Draco
|| G1 + G2 Hosting | Custom Theming | Donate to Gallery ||
Posts: 37
Limiting the number of banners per affiliate to one - when using the custom thumbnail option - is not perfect but tollerable. Using the custom_field was my first approach, that way I will have to enter the URL each time I create a new album. That's why I wanted to have all that info tied to the owner's data.
so no special development is necessary. Did I miss something? Yes the Imageblcok will probably work for general banner display. It will not take care of the redirection to the external site however.
and
sounded more promising, yet totally over my head.
Could you help me in that direction?
Posts: 31891
yeah, i forgot about the link to the other website. what about the link item module?
http://codex.gallery2.org -> user contributions -> link item module.
Posts: 37
Looks promising, let me install it...
Posts: 31891
maybe in conjunction with the imageblock, it could be what you want. don't know though if imageblock works with item links... it should.
Posts: 37
Hi valiant,
Thanks a lot for the link to the linkitem module. I thought that the codex site was documentation only. I had no idea that that's where you keep the little googies hidden ;-)
The linkitem works well. Now I just need to find a way, that the Linkitems are not displayed as thumbnails but as 1:1 images. I'll try to catch the author of that module.
OOPS, Mindless has already been on this train. So ist that something that has to be done in the template or does the module need a little modification on order to display the image and not the thumbnail?
globo
Posts: 31891
you'd have to modify the modules.
Posts: 8590
globo, not sure what you're trying to do... you want a link to another website created as a linkitem, but you want the image to be bigger? Upload a custom thumbnail for the linkitem and then set the thumbnail size to be big, in edit item/general, i guess.
Posts: 37
Hi mindless,
I was able to generate a LinkItem and upload a Thumbnail for it. However in the Thumbnail Settings it says:
GD Library 2.0.28 is up and running and all other graphis functions work in gallery2
Here is my SysInfo:
And i'm using Version 0.9 of LinkItems
globo
Posts: 31891
probably your GD can't handle this filetype.
install imagemagick / netpbm too.
Posts: 37
It's a JPEG, plain and simple. I thought that Gallery might not know whta to do with a LinkItem, since all the images I've tried yielded that same message when added as LinkItem but not when added as Image.
Posts: 31891
ah, just tried the link item for the first time.
- this thumbnail message refers to that it can't create a thumbnail from the link item directly
- but you can use the thumbnail module to add a customthumbnail for this item.
i did that and it works. i see a specific thumbnail that i picked for one of my link items.
to set the thumbnail (aka banner size in your case), you have to set the thumbnail size of the parent album of the link items.
Posts: 37
Hi valiant,
thanks for your patience and your willingness to get me through this thing. Just to illustrate what I'm looking for I've made this sketch:

I should have done the sketch right when I first posted, but better late than never...
As for the banner settings, call me stupid but I can't figure out how you did it. I tell you what I've done.
This is where I'm stuck. Could you guide me through the next needed steps in a little more detail?
globo
Posts: 31891
i've ne never said that i'm using my link item as banner.
to use your link item as banner, you'll have to:
(this approach will change your imageblock module to longer return photo, but link items)
1. create album, e.g. with the name banners
2. edit album, set thumbnail size to 700, change theme settings to show a single column only (not necessary, but looks nicer)
3. add a few link items to the albu
4. for each link item, click edit link, upload your banner image as custom thumbnail
Now we use this album as a random source for our banners for the whole gallery:
5. browse to http://codex.gallery2.org/index.php/Gallery2:Tpl_Reference#Blocks to see some docs
6. copy theme.tpl from themes/yourtheme/templates/theme.tpl to themes/yourtheme/templates/local/theme.tpl (yourtheme = matrix by default)
7. open the copy of theme.tpl in a texteditor
8. add:
{g->block type="imageblock.ImageBlock" blocks="randomImage" itemId="4255" maxSize=700 showDate=0 showOwner=0 showViews=0 showTitle=0 showHeading=0 useDefaults=0}e.g. right below the <div id=gsNavbar , use css to manage its appearance. 4255 is the id of the banner album, such that it selects a random banner.
but it doesn't work right now, because the imageblock doesn't return linked items when you're asking for randomImages.
9. in modules/imageblock/classes/ImageBlockHelper.class you'd have to replace
$data = array((int)$userId, 1, 'GalleryPhotoItem');with
$data = array((int)$userId, 1, 'GalleryLinkItem');but then, your normal imageblock will no longer work
ps:
you don't need the link item module for this. you could also use normal images, and e.g. store the URL target of the banner in the item summary or in a custom field.
in theme.inc, you could load a random image (random among all banners) and in theme.tpl, you could just use some html to show the image + make it point to another page.
you could also use the imageblock with normal images and get the linkTarget of the imageblock e.g. from the album summary...
i guess i'd prefer another approach. e.g. create a bannermanagement module for that purpose, with full blown features. but it's your time and resources.
Posts: 8590
ah, back on the linkitem thumbnail size.. valiant is right, it probably checks the parent items and sees it can't make a thumbnail from a linkitem directly.. but it has a thumbnail, so you could either manually change the operations in the db or try editing the tpl to skip that check and show the edit-size form anyway and it might work.
Posts: 37
I wish I had the time and resources to create such a module. As it is I really have neither
I'll try your approach and keep my mind open for other ones.
Thanks a lot for you help valiant.
globo
Posts: 18
Valiant: in G2.2.2 imageBlockHelper.class doesn't contain these lines, but instead has:
$typeMap = array('Image' => 1, 'Album' => 2);
* which I assume is doing the same kind of thing. *
I've duplicated and renamed the imageBlock module and i'd like to edit it to enable it to support linkItems for root page banner management. However, changing 'Image' to 'Link' doesn't work.
Could you give me some other clues on what needs to be changed? Thanks!