Developing a flash plugin for the ad module

alynner - April 11, 2007 - 23:25
Project:Advertisement
Version:5.x-1.3-2
Component:ad_flash module
Category:feature request
Priority:normal
Assigned:mixman
Status:closed
Description

Does this module support flash (swf) files?

#1

Jeremy - April 14, 2007 - 11:46

Not at this time. A contributed ad_flash.module would be welcome, anyone interested in writing it? (It is not something I will be writing myself, but I would happily bundle it with the other modules if contributed and written well.)

#2

liquidcms - May 2, 2007 - 06:10

wow, really.. no flash support... i guess back to the banner module

#3

reed.r - May 28, 2007 - 12:11

A module for displaying flash stuff shouldn't be that difficult. Looking at the image module I'm guessing you can do some easy copy paste and case closed. I'll get back when things are a bit clearer.

#4

Jeremy - May 28, 2007 - 13:39

It may also help to refer to the ad_types.txt file contained in the documentation directory included with the ad module. I started to document that process for creating a custom ad type in that file, though the document could use more work.

Ideally such a module would be contributed for both Drupal 4.7.x and 5.x, as both Drupal versions are currently fully supported by the ad module.

#5

reed.r - May 29, 2007 - 12:33

Here's a rudimentary module for flash support for 5 version, put it in the ad directory. I tried it and it works sofar.

AttachmentSize
flash.tar_.gz 5.66 KB

#6

liquidcms - May 29, 2007 - 17:11

was this simply copy/paste from image module or did you need to do some work... i need a 4.7 version so just wondering how much work to sort out.

#7

reed.r - May 30, 2007 - 07:25

Basically what I first did was replacing everything that said "image" with "flash" except original php function names which are used to get the height and width of an images. The good part is that they work with flash files so no need to change any of them.

I then proceeded to change the output code to this (just the return line in the ad_flash_display_ad($ad) function):

<?php

return ( "<div class=\"flash-advertisement\" id=\"ad-$ad->aid\"><object width=\"$flash->width\" height=\"$flash->height\"> <param name=\"movie\" value=\"$flash->path?clickTag=$ad->redirect/@HOSTID___\"><param name=\"wmode\" value=\"transparent\"><embed src=\"$flash_path?clickTag=$ad->redirect/@HOSTID___\" wmode=\"transparent\" width=\"$flash->width\" height=\"$flash->height\"></embed></div>");   
?>

With the click tag as clickTag.

#8

Jeremy - May 31, 2007 - 18:25

If the two modules are essentially identical, except when it comes to displaying the image, maybe it makes more sense to try and merge this functionality into the ad_image module?

#9

fax8 - June 2, 2007 - 11:02
Title:Flash files?» Developing a flash plugin for ad module
Component:ad.module» plug-in development
Assigned to:Anonymous» fax8

Hi all,

I've been contracted to develop a flash plugin for the ad.module.

The plugin will enable creation of flash ads using the ad module.
It will support url overwriting in swf file as the openads.org project supports.

My deadline is 11th June. As soon as the code is completed will submit a patch to this thread.

Anyone who is interested in this development and wants to give comments or contribute in any way please contact me or post here.

Fabio Varesano

#10

Jeremy - June 5, 2007 - 19:11

Great, fax8, I'll look forward to seeing your contributed module! Let me know if you run into any problems integrating this with the ad module.

#11

Boris Mann - June 6, 2007 - 18:19

Great stuff. Watching :P

#12

chrishaff - June 8, 2007 - 12:42

Most excellent! Have you considered using SWFObject http://blog.deconcept.com/swfobject/ to embed the Flash? It takes care of cross browser issues, EOLAS, etc. It would add a dependency though...

#13

fax8 - June 8, 2007 - 14:12

I wouldn't rely on a Javascript plugin for embedding... It is not the best solution IMHO.
I'm going to use the same swf code used by the video module.
It uses conditional comments and it's XHTML compliant...

However, I'm open to discussion on this.

#14

fax8 - June 12, 2007 - 16:17
Version:5.x-1.x-dev» 5.x-1.0-1
Status:active» needs review

Attached you find my ad_flash module implementation.
Unfortunately I had to develop it basing on ad.module version 5.x-1.0-1 because I've been stuck with the 0 width and 0 height images bug of the dev version.
I tried to fix that bug but without success.

It is able to convert hardcoded URLs.. it uses the lib-swf.php
library available on the Openads package (version 2.0.11-pr1).

I tested it with not too complex swf files with only one hardcoded url and it worked as expected.
It converts the url successfully.. However I think that with files with more than
one hardcoded urls it could fail.. I did not have such files here... so I was not able to test it.
Please try it with complex files .... and report the result: if you find problems please post the
not working swf file and I will try to fix it.

I still not updated the views logic (now the same as ad_image) but I plan
to do this if the module maintainer will like my ad_flash implementation.

Fabio Varesano

AttachmentSize
flash.tar__0.gz 10.8 KB

#15

bsonnich - June 13, 2007 - 18:58

When I installed the module I received the following error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/yournigh/public_html/sites/yournightyourcity.com.test/modules/flash/ad_flash.module on line 344

I thought I'd try to debug, but I had a hard time interpreting what that line should be doing.

#16

bsonnich - June 13, 2007 - 19:12
Version:5.x-1.0-1» 5.x-1.1

I don't know if this was the right fix or not, but I changed that line to be:

if (!ad_flash_active_file($node->files)) {

Now, when I try to activate the ad, I get the following error message:

Unable to mark ad as active until uploaded flash is validated. If you do not see any more errors, you should now be able to set your ad as active.

I should note that I am testing this on Ad_5.x-1.1. I suppose I should be expecting some conflicts.

#17

Jeremy - June 16, 2007 - 15:00

I'd like to hear more feedback from people who actually use flash ads. I don't use them myself. I will happily include this module in the ad/contrib folder, but I'd like to see some feedback that the module is working for people.

#18

fax8 - June 22, 2007 - 17:00

In reply to #15:
Change the error line into:

<?php
$activefile
= ad_flash_active_file($node->files);
      if (!
$activefile->fid) {
?>

This code should work also on PHP 4.x while the original one was only for PHP 5

#19

jgonzalez - June 28, 2007 - 17:30

Hello. Thanks for developing the flash banners implementation for this module.

I was able to install the module without problem. However, when I upload the flash banner it goes to "pending". Once I try to change it to "active" I get this error:

"Unable to mark ad as active as you have not uploaded any valid flash files. Setting ad as pending."

However, the flash ad was already uploaded. Due to this, the flash banner is not being displayed.

Any help would be really appreciated.

Johann

#20

dasil003 - July 12, 2007 - 00:24

jgonzalez - I experienced that project and it was due to the ad_flash row not being created in the database. I'm not sure what created that, but I just deleted the ad and created a new one. I had best luck when I uploaded the file and set the ad to active at the time I was creating it, rather than trying to do after the fact. When I did that I had other problems, including the file not being linked in the ad_flash table (which also triggered the same error, but for a different reason).

We are using this code in production. Displaying the ads in blocks did not work at first due to the javascript output being multi-line and thus breaking the document.write code. I submitted a patch at http://drupal.org/node/152610

#21

Jeremy - July 18, 2007 - 21:52

Has anyone successfully tested this module? Any feedback as to how well it works is very welcome. Also, it apparently has the same bug the image module had with uploading files, fixed here -- the fix should be merged into this module.

#22

fax8 - July 23, 2007 - 00:35
Status:needs review» needs work

the attached file should fix problems on setting active, also fix php 4 incompatibility above.
Put this file into ad/flash/ folder and save it as ad_flash.module (remove.txt)

Setting this as needs work. The flash support works pretty well here, but we are running
an older version of ad module (with in module groups support) ... my code should be ported
to the new version to be committed.

Fabio Varesano

AttachmentSize
ad_flash.module.txt 21.27 KB

#23

fax8 - July 23, 2007 - 01:12

Ops.. I just discovered some problems with multilines javascript strings (with '') which does not works. Attached file should fix.

IMPORTANT: please note that you have to set the $base_url in your drupal settings.php
This is due to a limitation of url() which will create paths starting from the url of the folder wich contains adserve.php

AttachmentSize
ad_flash.module_0.txt 21.23 KB

#24

fax8 - July 23, 2007 - 08:22

Probably the correct approach in generating the adserve.php output should be creating a
MENU_CALLBACK entry in ad_menu which, instead of return $output, it just print stuff...

This way it will be possible to deliver javascript files using a more Drupal based approach
(note that it should be also send correct js http headers).

Using this approach the $base_url needs will no more be required.

Fabio Varesano

#25

Jeremy - July 23, 2007 - 23:48

adserve.php very intentionally bypasses Drupal's bootstrap for performance reasons. That's why the ugliness in the first few lines of adserve() in adserve.php. In any case, why is ad_flash a special case that requires setting base_url when this isn't required by the other ad modules?

#26

fax8 - July 24, 2007 - 01:13

because once url conversions of hardcoded link has been completed I have to pass the full url as query on the flash file.
then simply using url() would result in http://host/path_drupal/path_to_module/path_menu_handler
where path_to_module it is something like sites/all/modules/ad/ which makes 404

#27

fax8 - July 24, 2007 - 01:28

see function theme_ad_flash_swf_render for the code... the call to url() on line:

<?php
$redirect_url
= urlencode(url('ad/redirect/'.$ad->aid, NULL, NULL, true));
?>

if called from adserve.php will generate something like http://example.com/path_to_drupal/sites/all/modules/ad/ad/redirect/122 .
Same issue if using relative urls (setting last param of url to false).

#28

Jeremy - July 24, 2007 - 01:56

Take a look at ad_image_display_ad() in the image module to see how it deals with this without requiring $base_url to be manually set.

#29

lazly - July 27, 2007 - 08:40

Hi!

This patch dont work in my site. The ad hos sent, and the block has been active, but the system dont diplay the flash ad. Default modules (text and img) has benn work.

Thx the feature develop! Adios!

#30

lazly - July 27, 2007 - 08:41

Hi!

This patch dont work in my site. The ad hos sent, and the block has been active, but the system dont diplay the flash ad. Default modules (text and img) has benn work.

Thx the feature develop! Adios!

#31

sliiiiiide - August 3, 2007 - 06:58

subscribing!

#32

lazly - August 3, 2007 - 08:34

I was the stupid at the last report, sorry! :(

But!

I have an error. If the admin user (user ID == 1) use the system, in the syslog I find lots of messages, like this:

Hely http://.../modules/ad/adserve.php?q=1&t=3
Üzenet file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/style.css) is not within the allowed path(s): (/usr/local/www/data/.../) - /usr/local/www/data/.../www/includes/theme.inc - 67. sor.

Other users dont generate this message.

Adios!

#33

Delta Bridges - August 11, 2007 - 04:33
Version:5.x-1.1» 5.x-1.3-2

"Unfortunately I had to develop it basing on ad.module version 5.x-1.0-1 because I've been stuck with the 0 width and 0 height images bug of the dev version."

Does this mean it will not work with the latest release of the ad module?
Many thanks,

#34

rudins - August 20, 2007 - 12:44

So, for me this "plugin" works fine.

Except, I had problem: flash banners appeared on top of thickbox layout on IE7.

Solution was simpe: find following in ad_flash.module:

  // params will be passed to both IE or not IE browsers
  $output .= '<param name="movie" value="'. $swfurl . '" />' . "\n" .
  '<param name="allowScriptAccess" value="sameDomain" />
  <param name="quality" value="high" />
  <p>'. t('Your browser is not able to display this multimedia content.<br />Please <a href="http://www.macromedia.com/go/getflashplayer" title="download the latest Flash player">download the latest Flash player</a>.') .'</p>
</object>';

and replace with:

// params will be passed to both IE or not IE browsers
  $output .= '<param name="movie" value="'. $swfurl . '" /><param name="allowScriptAccess" value="sameDomain" /> <param name="quality" value="high" /><param name="wmode" value="transparent" /> <p>'. t('Your browser is not able to display this multimedia content.<br />Please <a href="http://www.macromedia.com/go/getflashplayer" title="download the latest Flash player">download the latest Flash player</a>.') .'</p></object>';

The key is: <param name="wmode" value="transparent" />

#35

Jose Reyero - September 8, 2007 - 11:33

I'm giving it a try and it works, at least it shows the banner right, with FF :-)

Not sure why it needs a required url, I wrote one but it doesn't work, nor how the click counting will work with links in ad banners.

It would be nicer though if it used some Drupal flash library (swftools?) instead of a different one.

#36

prachait - September 23, 2007 - 12:33

I was looking in the code, and found it use as

<?php
  $result
= db_query('SELECT * FROM {ad_groups}');
  while (
$group = db_fetch_object($result)) {
   
$form["group-$group->gid"] = array(
     
'#type' => 'fieldset',
     
'#title' => $group->name,
     
'#collapsible' => TRUE,
    );
?>

where ad_groups table does on exists either in the ad module or ad_flash.

I got the error, in the first instance, later on, i change to the code similar to ad_image, and it worked
but still have 2 major issues

1. The fid = 0
2. the status becoming to pending, with any update.

Can any one give the suggestion on this
also, in which dev module ad_flash will come with in ad module as image or text ad

Waiting for reply
Prachait

#37

xushi - October 4, 2007 - 12:29

Reading through the comments i see a lot of patches and edits here and there.. Is there a way to provide a newer version that adds all these fixes, to cause less confusion and errors in setting the module up ?

Thanks.

#38

mixman - October 10, 2007 - 11:50

I've attached my "personal" version of the ad_flash plugin/module - it's really fresh (24 hours, to be exact), but AFAIK it works quite fine. I'm currently testing it, so use it at your own risk.

It was developed/modified for Drupal 5.2 and ad-5.x-1.3-2 based on the source of ad_image and the files I've found here.

I've tested it with Firefox 2, IE6 and IE7 and (for now ;)) it seems to work fine. The SWF files are being embeded using Adobe scripts found at http://www.adobe.com/devnet/activecontent/articles/devletter.html.

The attached ZIP file contains the whole ad_flash (flash) directory - just extract it under the ad module directory and activate inside Drupal. Of course make a full database backup before.

Hope it helps.

Download from: http://drupal.pl/files/drupal/ad_flash.zip

#39

Jeremy - October 10, 2007 - 14:14

I'd like to see some feedback confirming that this module works well. If so, it could be merged into the ad module's contrib/ folder. mixman, is this something you plan to maintain?

#40

mixman - October 10, 2007 - 14:33

Jeremy - I think, that I can say here "Yes". I need the flash ad functionality in a Drupal project I'm currently intensively working on, thus I'm quite sure, that I'll spend some time fiddling with it during the next few weeks.

As for the feedback - I hope there will be some, as this code is really fresh (like I said - hours, not days).

#41

Jeremy - October 10, 2007 - 14:49
Component:plug-in development» ad_flash.module

I've added an ad_flash.module component to the issue tracker, moving this issue there. As you plan to continue maintaining this, please assign this issue to yourself.

#42

mixman - October 11, 2007 - 09:57

Will do. Just need some time to familiarize myself with the Drupal issue system (I'm a newbie in this matter)

#43

mixman - October 12, 2007 - 14:12

Sorry if this is a silly question, but I need somebody to help me out here - should I create a new issue and then assign it to myself, or were you talking about something else?

#44

Jeremy - October 12, 2007 - 14:17

When you add a comment to this issue, there's a drop down in the top section titled "Assigned". Adjust that if you wish to own this issue.

#45

mixman - October 12, 2007 - 15:06
Assigned to:fax8» mixman

OK, thanks a lot and sorry for taking your time :)

#46

Garrett Albright - October 16, 2007 - 20:36

Great job on the Flash plug-in, fax8 and mixman!

Having some problems with the link conversion feature, though… I'm always getting "Unable to find link urls in the Flash file. Links conversion not available." Is there a trick to it? I'm using Flash CS3, but I've tried exporting as Flash 8, ActionScript 2, uncompressed, etc, but still seeing the error. Also tried fiddling with the permissions on the Flash file itself, but that didn't help either. Could it be that the link has to be implemented via ActionScript instead of by using the little link box in the Flash GUI? (Haven't tried that yet.) Any suggestions anyone can offer as to how to get this working will be appreciated. Thanks in advance.

#47

mixman - October 17, 2007 - 08:19

Unfortunately this feature isn't working yet as it suposed to be. In fact, it doesn't work at all :-/ Sorry, but I did not need it in my project, so I just left the original code alone. I'll work on it someday, but for now...

#48

Garrett Albright - October 17, 2007 - 19:56

Okay, well, after taking a serious stab at the problem myself, I almost got it…

<?php
function findLinks($swf){
   
//Finds the links in an SWF file. Right now, should only work for links created in the GUI, not in ActionScript. Also, may only work with Flash 9 files.
   
preg_match_all('/"(https?:\/\/[^"]*)"/i',$swf,$matches,PREG_OFFSET_CAPTURE);
    if(
count($matches[0])>0){//Will ==0 if no matches were found
       
array_shift($matches[0]);//First item matches whole string and is not needed
   
}
    return(
$matches[0]);
}

function
replaceLinks($swf,$convs,$nid){
   
/* Replace the links in an SWF file.
    This code is a bit flawed in that it converts all links of the same URL in the file. For example, if you have two links to example.com, it won't be possible to replace one and not the other. There are ways around this, but they would be a bit processor- and memory-intensive -- a concern for our client. We don't expect to ever need to replace anything other than all the links in a file anyway. */
   
if(!is_array($convs) || count($convs)==0){
       
//We're not being told to convert anything
       
return($swf);
    }
   
$matches=findLinks($swf);
    if(
count($matches)==0){
       
//Theoretically this will never happen as it would mean that links were found in the SWF previously but not now, but you never know…
       
return($swf);
    }
   
$toChange=array();
    foreach(
$matches as $id=>$match){
        if(
in_array($id,$convs)){
           
//We can substitute this one
           
$toChange[]=$match[0];
        }
    }

    if(
count($toChange)>0){
       
//Do it!
       
$toPath='"'.base_path()."ad/redirect/{$nid}/\"";
       
$changed=str_replace($toChange,$toPath,$swf);
       
//First 4 bytes are a magic number; next 4 bytes are the filesize
       
$changed=pack('V',156456774).pack('V',strlen($changed)).substr($changed,8);
        return(
$changed);
    }
   
//No conversion was done
   
return($swf);
}
?>

The problem is that there seem to be three scattered bytes by which a converted SWF and an SWF changed "by hand" are different, and I can't figure out their significance. So this outputs a Flash file which can be opened by Flash Player and such, but just displays a white box.

So close and yet so far. I'm going to give up for now…

#49

mixman - October 18, 2007 - 18:30

That's a shame...
As for the ad_flash project - I've applied for an CVS account. If I get one, I'll try to upload a new (still dev) version of the module ASAP. It allows you to upload not only SWF, but also FLV files, recognizes them and displays using an included OpenSource player (FlowPlayer. to be more precise). It still needs some work (i.e. one can change the player options only by theming a specific function) but... it works. One step at a time ;-)

#50

capitano83 - October 23, 2007 - 14:04

hi,
i have just installed this fantastic module.
i have only a question:

when i ovverride swf url (works fine with url inserted by flash GUI) and click on the banner,
drupal open a new page on my site "Page not found" with this url:

http://localhost/drupal-5.2/undefined

what i wrong?
Best regards,
Max

#51

Garrett Albright - October 23, 2007 - 17:42

Capitano, do you think you could post the .fla file for that working movie? If you got link substitution to work that far, then you've gotten farther than I have!

"undefined" sounds like more of an ActionScript problem than a PHP one; PHP does not have a value which is analogous to ActionScript/ECMAScript's "undefined." So maybe double-check your Flash movie. Is it possible that there's more than one link in the movie?

#52

jsaints - October 23, 2007 - 18:21

I am having the same difficulty as capitano83. When i substitute URLs the link is to an undefined page.

#53

mixman - October 25, 2007 - 12:52

Ok, here's a new version of ad_flash:

Download: http://www.egie.pl/files/ad_flash.zip

Please note, that I've removed the "Substitute URLs" feature, as it doesn't (yet) work as it should. If you guys can repeair it, please do. Also, if you need this feature, then please stick to the first version, as you won't find it here.

What's new?

I've added FLV support - when you upload an FLV instead of a SWF, the module will recognize this and use a built-in player (FlowPlayer, to be more precise) to show the FLV.
To change the player options (resolution, buttons, buffer size etc.) you have to define your own version of the ad_flash_flv_render() function. It can be a little frustrating, cause this function is also responsible for embeding FlowPlayer into HTML and you have to copy the whole code. I'll change it in the future, but for now...

P.S. No CVS account for now, so I'll publish the code here. When it's (beta) ready, I'll apply for an account again.

#54

sliiiiiide - October 25, 2007 - 21:14

I'm recieving the following error after submiting a .swf flash ad:

Fatal error: Only variables can be passed by reference in ... /httpdocs/gdevint/sites/all/modules/ad/flash/ad_flash.module on line 461

It looks like it has something to with the ad groups when going to this line. unfortunately i ama dunce at php and have got stuck...

It appears as if the ad is submitted OK (it appears properly in the database) just a problem displaying it...

I'm using php version 4.3.9

#55

mixman - October 25, 2007 - 22:41

I'm using PHP5, so this error doesn't appear in my case.
Try changing line 461 from:

$term = array_pop(taxonomy_node_get_terms($ad->aid));

to:

$terms = taxonomy_node_get_terms($ad->aid);
$term = array_pop($terms);

Don't know if that will help (haven't tested it in practice), but it's worth a try.

#56

sliiiiiide - October 26, 2007 - 05:29

thanks mixman, you're a weapon, flash ads are displaying properly know...

#57

mixman - October 27, 2007 - 11:57

A version including the aformentioned patch for PHP4 and a new themable function for changing the FLV player options (see theme_ad_flash_player_settings).

http://www.egie.pl/files/ad_flash_1.zip

#58

mixman - November 13, 2007 - 15:53

Some feedback would be appreciated.
Is anyone using ad_flash? If so - is it working?

#59

real1st - November 15, 2007 - 10:38

Yeah, I use it and it works! Thank you very much!

#60

Delta Bridges - November 16, 2007 - 16:13

Yes, working well :)

#61

Jack_Sparrow - November 18, 2007 - 12:18

Just to add...
I've noticed that the links on the flash ads don't work...
Should we be putting links into the actual flash ad before uploading, or is there a problem in having the system do this?

#62

Pixelstyle - November 22, 2007 - 18:29

I'm using mixman's version. Everything works fine when logged in, but when an anonymous user visits the site he'll see the following error message:

Fatal error: Call to undefined function: drupal_add_js() in /home/httpd/vhosts/sitename/httpdocs/modules/ad/flash/ad_flash.module on line 35

I'm using a regular swf banner, php4, Drupal 5.1, Ad 5.x-1.3-2. Any idea?

#63

pierrelord - November 26, 2007 - 04:04
Category:feature request» task
Status:needs work» active

I use it.
It works perfectly in IE6 and FF, both logged in and anonymous.
Thanks a lot guys!

Drupal 5.3 - PHP5
Mixman's #57 - http://www.egie.pl/files/ad_flash_1.zip -
Advertisement module V. 5.x-1.3-2 -
Flash banner made in flash CS3 with no embedded links inside the SWF..

Thanks!

#64

xushi - November 26, 2007 - 08:04

Same here.

I think it's about time this at least is added to the dev- branch.

#65

Jack_Sparrow - November 26, 2007 - 08:34

I downloaded Mixman's #57 ad_flash and uploaded, but the links still do not work???

#66

mixman - November 26, 2007 - 18:04

Sorry for the lag. And thanks for the replies.

Just to add...
I've noticed that the links on the flash ads don't work...
Should we be putting links into the actual flash ad before uploading, or is there a problem in having the system do this?

You're right. To tell the truth, I don't really know why - the Adobe scripts used in ad_flash generate the correct code, so the links should work. But they don't. I'll look into it, as I'm also very interested in correcting this quirk :) For now, please put the links into the flash files.

Fatal error: Call to undefined function: drupal_add_js() in /home/httpd/vhosts/sitename/httpdocs/modules/ad/flash/ad_flash.module on line 35
I'm using a regular swf banner, php4, Drupal 5.1, Ad 5.x-1.3-2. Any idea?

Not a clue. This function is part of the Drupal core, so it should be always defined. If I'm wrong, please correct me.

#67

danthalian - November 27, 2007 - 11:41

Subscribing

#68

danthalian - November 27, 2007 - 23:02

Ive added mixmans module, and it shows the ads correct.

When hardcoding links inside the flash files, it begins counting clicks etc..

It would be great if the clicktags worked.. problem lies in when other companies want to advertise on my site, they send me the flash banner - they dont have hardcoded links but use clicktags... so its a big problem :(

#69

rudeboyal - December 11, 2007 - 18:57
Category:task» bug report
Priority:normal» critical

Hi, I've installed the ad_flash module and it works correctly on my local Drupal 5.3 server but when when I install it onto my online Drupal 5.2 setup the upload file doesn't actually do anything. I browse for a swf and attach it and the loader bar shows and animates but then no file shows above the loader.
The server runs on php4 so I made sure i got the one with the patch. Is there anything I need to do to make the patch work?

Thnx for this great module!

#70

chavalina - December 14, 2007 - 09:20

Hi,
I've installed Ad and ad_flash plugin in Drupal 5.5 and everything seems to work fine. I've installed the #57 version of this plugin.

Please note, that I've removed the "Substitute URLs" feature, as it doesn't (yet) work as it should. If you guys can repeair it, please do. Also, if you need this feature, then please stick to the first version, as you won't find it here.

I've found an issue: clicks are not count for these advertisements, so maximum number of clicks schedule does not work. This also happened to me with Drupal 5.2 and 5.3.

Does this happen to someone else?

#71

jim_at_miramontes - December 20, 2007 - 05:01

I'm trying to get this working, but without success. It looks like appropriate code is getting written into the page to cause the .swf file to be presented, butthe javascript code -- AC_RunActiveContent.js in particular -- isn't getting loaded, since when I load the page in Firefox, the error console reports that AC_FL_RunContent is not defined. I've put a var_dump into the page to see what drupal_add_js should be causing to be loaded, and it returns:

add js = array(5) {
  ["core"]=>
  array(2) {
    ["misc/jquery.js"]=>
    array(2) {
      ["cache"]=>
      bool(true)
      ["defer"]=>
      bool(false)
    }
    ["misc/drupal.js"]=>
    array(2) {
      ["cache"]=>
      bool(true)
      ["defer"]=>
      bool(false)
    }
  }
  ["module"]=>
  array(2) {
    ["modules/ad/flash/scripts/AC_RunActiveContent.js"]=>
    array(2) {
      ["cache"]=>
      bool(true)
      ["defer"]=>
      bool(false)
    }
    ["modules/contrib/vote_up_down/ajax_vote_up_down.js"]=>
    array(2) {
      ["cache"]=>
      bool(true)
      ["defer"]=>
      bool(false)
    }
  }
  ["theme"]=>
  array(0) {
  }
  ["setting"]=>
  array(0) {
  }
  ["inline"]=>
  array(1) {
    [0]=>
    array(2) {
      ["code"]=>
      string(183) "
var now = new Date();
var offset = now.getTimezoneOffset();
if (!(offset == 480)) {$(document).ready(function(){$.get("http://www.example.com/autotimezone/" + offset);})}"
      ["defer"]=>
      bool(false)
    }
  }
}

so it seems like the Adobe code should be getting loaded. But I claim very little expertise with this module; Any thoughts?

#72

yngens - December 22, 2007 - 06:34

i confirm this error

#73

jim_at_miramontes - December 22, 2007 - 17:55

never mind re comment #71: theming issues at my end were keeping the scripts from getting written into the page. Display is now working correctly.

#74

jim_at_miramontes - January 22, 2008 - 01:13

Regarding getting the links working on Flash pages --

I built a new version of theme_ad_flash_render, borrowing code from ad_image_display_ad to insert the "A" tag, like so:

function mysite_ad_flash_render($ad, $flash) {
// Get the groups (terms) this ad belongs to and use the first one
$terms = taxonomy_node_get_terms($ad->aid);
$term = array_pop($terms);
$term = strtolower($term->name);

$flash->type = strtolower(pathinfo($flash->path, PATHINFO_EXTENSION));

//jrm addition
  $flash_path = preg_replace('&'. drupal_get_path('module', 'ad') .'/&', '', file_create_url($flash->filepath));
  $target = variable_get('ad_link_target', '_self');

$output = "<div class=\"flash-advertisement flash-advertisement-{$flash->type} ad-group-{$term}\" id=\"ad-$ad->aid\">";

//jrm addition
$output .= "<a href=\"$ad->redirect/@HOSTID___\" target=\"$target\" title=\"". htmlentities($flash->tooltip, ENT_QUOTES) ."\">";

$output .= theme('ad_flash_' . $flash->type . '_render', $ad, $flash);

//jrm addition
$output .= "</a>";
$output .= "</div>";

return $output;
}

and it seems to be working fine for me, logging page views and clicks. I dunno; am I missing something here or is this a reasonable solution?

#75

ncameron - January 15, 2008 - 23:49

I'm trying this with the latest version of ad module its not working. I renamed this function (phptemplate_ad_flash_render) and put it in my template.php. Am I missing something? Has anyone else found a work around for this yet?

Cheers,

Neil

#76

attb2 - January 17, 2008 - 09:46
Status:active» fixed

I've solved drupal_add_js() issue.
During the initialization methods, 'common.inc' not yet included, while ad_flash_init() called. You must insert this line to ad_flash.module file:

<?php
function ad_flash_init() {
  if (
function_exists('drupal_add_js'))
  {
   
drupal_add_js(drupal_get_path('module', 'ad_flash') . "/scripts/AC_RunActiveContent.js");
  }
?>

#77

Jeremy - January 17, 2008 - 13:09
Category:bug report» feature request
Priority:critical» normal
Status:fixed» needs work

Please don't close this issue until the primary issue is resolved -- read the title, it is about getting a flash module merged into the ad module. I would like to see it merged, however currently I see more problem reports than I see reports of it working. It needs some love before it can be merged, and multiple people to report using it successfully.

#78

xushi - January 20, 2008 - 14:16
Component:ad_flash.module» ad_flash module

Jeremy@

At least it should be merged into the DEV branch.. It's working, but not 100%, but that's what the DEV is there for.. At least, then, each problem should have it's own ticket and no need to start going back 20 - 40 posts and patch left and right.

I didn't check yet, i've been away for a week.. If it did, that's great news.

#79

rolandk - February 6, 2008 - 16:12

I'm late on this thread. Can anyone tell me which version is working ? mixman's or fax8 ? I'm using drupal 5.7

Thanks

#80

xushi - February 6, 2008 - 17:49

@rolandk

The one in comment #57 worked for me. I'm not sure if there were any other ones updated after that, but give it a try and see.

#81

Jeremy - February 6, 2008 - 17:58

I did a quick test of #57 a week or two ago. I found it mostly functional, though it did not offer simple click tracking. Another problem is it contains code from an external project, compounded by the fact that this other project is not licensed under the GPL.

Ideally, what I'd prefer is to see someone create a new ad_flash project that is maintained outside of the ad module. This will give the project its own issue queue. The external code needs to be removed, replaced with instructions on how to obtain and install this code. Is there anyone interested in leading this effort?

#82

asak - February 12, 2008 - 21:28

subscribing

#83

fax8 - February 13, 2008 - 11:59

the LICENSE.txt contained into the file available at http://www.openads.org/products/openads/download as well as the lib-swf.php file explicitely says that it's realeased under the GPL.

#84

Jeremy - February 13, 2008 - 16:49

When I extract ad_flash_1.zip and review flash/player/LICENSE.txt, I find that it is an Apache license, not a GPL. Perhaps you and mixman each used a different flash player?

Furthermore, my understanding is that externally maintained projects are generally not intended to be mirrored within Drupal's contrib.

In any case, I'd like to see a new project set up for the ad flash module, rather than distributing it within the main ad package.

#85

levavie - February 18, 2008 - 05:23

re: What is working?

The one in #57 worked, but only after applying the patch in#76.
I haven't tried the links feature on #74 yet.

Amnon
-
Professional: Drupal Israel | Drupal Development & Consulting | Eco-Healing | Effective Hosting Strategies | בניית אתרים
Personal: Hitech Dolphin: Regain Simple Joy :)

#86

beekay1076 - February 25, 2008 - 04:38

Hi all,
I'm completely new to Drupal and relatively new to php but have managed to make some minor modifications to a few of the functions in the ad_flash.module file to allow for the clickTag method. I've implemented on my test site and it works for me.
Note, I used the file in #57 plus the patch in #76 and the links feature on #74 but wasn't having success with the ad being clickable.
The functions that I made changes to are theme_ad_flash_render(), theme_ad_flash_swf_render(), and theme_ad_flash_flv_render().
It's basically adding the link url as the clickTag variable through flashVars. I've also removed the output of the 'a' tag.
See below:

function theme_ad_flash_render($ad, $flash) {
// Get the groups (terms) this ad belongs to and use the first one
$terms = taxonomy_node_get_terms($ad->aid);
$term = array_pop($terms);
$term = strtolower($term->name);

$flash->type = strtolower(pathinfo($flash->path, PATHINFO_EXTENSION));

//jrm addition
  $flash_path = preg_replace('&'. drupal_get_path('module', 'ad') .'/&', '', file_create_url($flash->filepath));
  $target = variable_get('ad_link_target', '_self');

$output = "<div class=\"flash-advertisement flash-advertisement-{$flash->type} ad-group-{$term}\" id=\"ad-$ad->aid\">";

$output .= theme('ad_flash_' . $flash->type . '_render', $ad, $flash);

$output .= "</div>";

return $output;
}


function theme_ad_flash_swf_render($ad, $flash) {
    // The .swf extensions isn't needed, because we use Adobe scripts
    $url = str_replace('.swf', '', $flash->path);

    $output = "<script type='text/javascript'>AC_FL_RunContent('codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','src','" . $url . "','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','" . $url ."','width','" . $flash->width . "','height','" . $flash->height . "','menu','false','wmode','transparent','flashvars','clickTag=" . $ad->redirect . "');</script>";
    return $output;
}

function theme_ad_flash_flv_render($ad, $flash) {
    $player = '/' . drupal_get_path('module', 'ad_flash') . '/player/FlowPlayerWhite.swf';
    $url = $flash->path;

    if ($flash->url) {
        $output = '<div class="info">' . l(!empty($ad->title) ? $ad->title : $flash->url, $flash->url, array('target' => '_blank')) . '</div>';
    }
  
    $settings = theme('ad_flash_player_settings', $ad, $flash);
    $settings = array_merge(array('videoFile' => $url), $settings);
    $conf = ad_flash_player_conf($settings);

    $output .= "<object type=\"application/x-shockwave-flash\" data=\"{$player}\"  width=\"520\" height=\"440\" id=\"FlowPlayer\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"{$player}\" /><param name=\"quality\" value=\"high\" /><param name=\"scale\" value=\"noScale\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"flashvars\" value=\"clickTag=" . $ad->redirect . "&config={" . $conf . "}\" /></object>";

    return $output;
}

#87

druclogs - March 3, 2008 - 15:55

Hi Mixman
I have the same error when not logged in on two independent sites. First access to any number of pages works fine but either refreshing the page or returning to a previously accessed page causes the fatal error. The whole site therefore is unusable for anonymous viewers.
I also note that any update to an article or the admin section (from a different PC) subsequently allows the original failed page to reload correctly, but again only once. Is this a useful clue?

I'm using Drupal 5.1, PHP 5.2.4 and version #57 flash_ad.

Any advice or help would be much appreciated

#88

druclogs - March 3, 2008 - 16:00

I am referring to Fatal error: Call to undefined function: drupal_add_js() in /home/httpd/vhosts/sitename/httpdocs/modules/ad/flash/ad_flash.module on line 35

reported by Pixelstyle in #62

#89

gordns - March 12, 2008 - 21:22

The patch in #86 fixed the clickTag problems for me.

Thanks!

#90

aether - April 7, 2008 - 22:13

This is the combo that worked for me:

#57 patch
#76
#86

Works like a charm. The only stipulation being that the flash file must be created to handle clickTAGs.

#91

dortez - April 8, 2008 - 00:49

would someone provide the updated working one? I can not seem to get it right. Thanks a lot!

#92

bevinlorenzo - April 10, 2008 - 03:28

I followed these comments, and now when I click on any ad, either image or flash, it goes to the redirect page and I get a 'PAGE NOT FOUND' error. I have been trying to debug for the last 4 hours with no luck. When I click on the 'my ads' link it also goes to a PAGE NOT FOUND page. What the hell did I break?

#93

Jeremy - April 16, 2008 - 00:54
Status:needs work» won't fix

Please create a new project for this. I do not use flash modules myself, and do not see any need to maintain this within the core ad module.

#94

Pixelstyle - April 16, 2008 - 12:30

I don't understand why this can't be merged in core ad module. Flash ads are very popular and the lack of support for it in ad-module was something that suprised me when I first installed it.

I don't mean to be rude, but shouldn't the versatility of the module supercede the fact that you might not need Flash support yourself?

#95

Jeremy - April 16, 2008 - 12:37

It's not going into the ad module core because I'm not going to maintain it, pure and simple. But that doesn't keep anyone else from maintaining it as a stand-alone project. The problem being, this ad_flash issue has been open for a full year now, and nobody has claimed ownership for any sustained period of time. That tells me that if I merge the code into core, I either have to maintain it, or it quickly drifts out of sync and generates endless bug reports. And as I know I'm not going to maintain it...

If you firmly believe that a flash plug in is so important: start an ad_flash project, sift through this thread from the past 12 months finding the best patches, and start maintaining it yourself. Nothing is stopping you. If any critical and justifiable hooks are missing in the core ad module, I'll gladly add them.

#96

reed.richards - May 24, 2008 - 16:47

Did #90 and put it in this zip-file.

Now if someone would just take the responsibility for the flash_ad module and maintain it...

Selah

AttachmentSize
flash.zip 570.88 KB

#97

Animatour - June 21, 2008 - 19:05

Is there a Flash Plugin for ad module that works with Drupal 6.0?

#98

MM-Steven - June 30, 2008 - 18:17

Hello,

I have installed Advertisement for a small project I'm working on, then I was told that they have been selling Flash Ads... so I did a quick look and installed the flash part... For some reason the flash ads will not link to the URL entered, I have pathauto installed and wondered if that could be conflicting with it. I doubt it tho..

If anyone has had this problem or any idea of fixing it, your help would be greatly appreciated..

#99

reed.richards - July 2, 2008 - 09:28

Removed some code from the hook_init as it sent an error when caching was turned on and moved it to hook_menu instead. I also turned of the previewing of the flash on the node edit page as it caused a severe error when some other flash banners were displaying on the page at the same time.

AttachmentSize
flash.zip 570.92 KB

#100

ahoms - July 30, 2008 - 07:04

hi everybody,

I'd really appreciate some help.

Regarding #90, what does "the flash file must be created to handle clickTAGs" mean? How do I do that?

thanks in advance

#101

Ehud - August 9, 2008 - 19:47

Hello,

Thank you very much for this flash plug-in!

I use 5.x-1.5. discovered it doesn't support flash. Does any one know when the flash plug-in will be added to the dev- branch (tried it and coudn't activate it).
Thanks!

#102

mcneelycorp - August 8, 2008 - 06:33

Just want to say thanks to mixman and whoever else contributed to make this addon possible. What is left for this addon to make it the drupa.org module list?

#103

yhager - August 11, 2008 - 08:49

the module in #99 caused a duplicate function error for ad_flash_views_tables, I had to put the views inclusion code within

<?php
if (!$may_cache) {..}
?>
clause (since hook_menu might be called twice).

And I feel like openning a project called ad_flash and stating on the front page: 'This module is just so ad_flash will have a proper place. I have just opened this project as a service for the community. If you want to maintain it - it's yours"

:-)

#104

rak - August 23, 2008 - 19:42

Somebody just open up a new project for ad_flash. I don't care who would manage the project, until it stays active. Even if the ad module developer doesn't need it and can't maintan it either, these days the flash ads are a must to have.
--
RAk

#105

cerber0s - August 26, 2008 - 16:13

Selling ads is what keeps many Drupal sites up and running. Drupal seriously needs support for flash ads, if it's via an addon then so be it. All those willing to donate $15 to the person who give us the module say I. I'll start with $15.

What features does the module need to have?

  • clicktags support
  • .swf files support (any more?)
  • D5+6 compatible (dependent on Advertisement being D6 compatible)
  • anything else?

#106

Delta Bridges - August 27, 2008 - 02:34

$15 for me too :)

#107

Ehud - August 31, 2008 - 03:25

You can count me in.

#108

asak - September 6, 2008 - 07:47

I'm in.

#109

rak - September 14, 2008 - 17:47
Title:Developing a flash plugin for ad module» so... is anybody taking the project or not ?

so... is anybody taking the project or not ? helping is a thing, but somebody has to have time to manage the project, I can help now and then, but I can't lead a project because of the limited free time I got... If somebody thinks that can face it, do so, weeks pass away, because of not having a manager.
--
RAk

#110

Jeremy - September 17, 2008 - 17:31
Title:so... is anybody taking the project or not ?» Developing a flash plugin for the ad module
Status:won't fix» postponed

@rak, do not change the issue title, it makes the issue harder to find.

Marking as postponed, waiting for someone else to come along and take this over in a new project.

#111

amfis - September 18, 2008 - 06:04

So who could fix that duplicate function error for ad_flash_views_tables mentioned in #103. Where do I need to add !may_cache ?

And also...
this 'fix' causes logged user to logout from drupal site. It just somehow drops session data I guess.

Steps to confirm:
1. enable flash module
2. insert some flash ads (works with 1 too)
3. go to front page
4. go to administer site section
5. got logout. (this works not every time)

And I also suspect that this is because of Ad cache. I use it for my site.

#112

bighead03 - September 18, 2008 - 17:18

i've applied the patch, but when I edit the ad, it loops but no result, any idea on how to handle this?

#113

reed.richards - September 19, 2008 - 10:13

I might be up for takeing on this module, just started studying and got some free time to spare... I'll see if I can get it going.

#114

rak - September 20, 2008 - 16:05

#110 - true, sorry... I'm glad You changed it back.
--
RAk

#115

rak - September 20, 2008 - 16:12

I updated the ad module to version 5x-1.6 for Drupal 5, since then the ad_flash.module stopped working. It seems the two aren't compatible, but I didn't figure what the problem could be. I hope reed.richards takes the module :)
--
RAk

#116

Delta Bridges - September 22, 2008 - 07:46

# 113: Great news reed.richards :)
THanks,

#117

einkahumor.com - September 23, 2008 - 15:14

Subscribe.

I'm in for the $15 donation thing.

#118

jaysonjust - September 24, 2008 - 00:16

drupal_add_js problem. I installed #96 and I still had drupal_add_js problem when users are not logged in. The solution listed in #76 worked once I applied it. However I felt the instructions were a little unclear when I first read it. It says to add this to the ad_flash.module file. This however caused other problems. I looked at into it and I had to replaced the existing code starting at line 34 going to line 35 with the above mention. Thus I removed;

function ad_flash_init() {
drupal_add_js(drupal_get_path('module', 'ad_flash') . "/scripts/AC_RunActiveContent.js");

and replaced it with;

function ad_flash_init() {
  if (function_exists('drupal_add_js'))
  {
    drupal_add_js(drupal_get_path('module', 'ad_flash') . "/scripts/AC_RunActiveContent.js");
  }

Full code starting from line 30;

/**
* Drupal _init hook.  Include ad_flash_views.inc if the views.module is
* enabled.
*/
function ad_flash_init() {
  if (function_exists('drupal_add_js'))
  {
    drupal_add_js(drupal_get_path('module', 'ad_flash') . "/scripts/AC_RunActiveContent.js");
  }
  if (function_exists('drupal_set_content')) {
    if (module_exists('views')) {
      include drupal_get_path('module', 'ad_flash'). '/ad_flash_views.inc';
    }
  }
}

#119

xamount - October 1, 2008 - 23:59

subscribing

#120

insats - October 17, 2008 - 11:24

subscribing

Got the latest zipped file (#99) in this thread but cant get ad links to work

#121

chris.cohen - October 24, 2008 - 10:14

Sorry guys, I applied to take on this and turn it into a project as suggested by many people, but was declined. Anybody else want to try their hand? Otherwise, unfortunately, this looks set to remain a messy thread.

#122

chris.cohen - October 24, 2008 - 10:21

With regard to the duplicate function error described by yhager in comment #103, relating to the version in #99, I have attached my solution which will get around the problem.

AttachmentSize
flash-chris.cohen_.zip 570.37 KB

#123

xamount - October 31, 2008 - 05:27

hmmm....this thread has been going on a while now. I would be willing to contribute $25 to get some development done....I cant seem to get the right order of patches applied from the various comments on this page. Where can I download the latest "stable" version? i'll be on the lookout to make the donation once someone can deliver...

#124

drupalnuts - November 6, 2008 - 14:04

I am in for $100US, if someone can get this merged into the ad project. I don't want a different module, I want it supported by the core ad devels. (Or the core ad devels could create a different module)

#125

drjonez - November 8, 2008 - 06:26

I'm in d6, will any of these add ons work there?

#126

triversedesigns - November 12, 2008 - 04:51

$100 AUS (which is worth about a quarter to the US haha) to have the flash module integrated into the ad module and ported to d6.

#127

LynnS - November 12, 2008 - 18:39

I'm in for $25 if someone takes this on. Subscribing.

#128

drjonez - November 13, 2008 - 07:19

I'll pitch in $3,584.4 Zimbabwe dollars

(about $1usd (i'm broke, okay?))

Seriously, this module NEEDS the flash :)

#129

Jeremy - November 19, 2008 - 17:29

This module will not ever go into the ad module core because I don't need it and I'm not going to maintain it, pure and simple. But that doesn't keep anyone else from maintaining it as a stand-alone project. The problem being, this ad_flash issue has been open for a full year and a half now, and nobody has claimed ownership for any sustained period of time. Furthermore, people obviously aren't reading through the full issue when they add new comments. That tells me that if I merge the code into core, I either have to maintain it, or it quickly drifts out of sync and generates endless bug reports. And as I know I'm not going to maintain it...

If you firmly believe that a flash plug in is so important: start an ad_flash project, sift through this thread from the past 18 months finding the best patches, and start maintaining it yourself. Nothing is stopping you. If any critical and justifiable hooks are missing in the core ad module, I'll gladly add them.

#130

chris.cohen - November 19, 2008 - 17:35

I understand why you don't want to incorporate it into the core ad module, and it would suffice to exist as a stand-alone add-on. I volunteered to take ownership of this (the kind offers of money have no bearing on this - my interest is in making a better ad module), but I was not allowed to have the CVS account required to create the project.

Perhaps it would help if I were to receive a recommendation from you, Jeremy? Whether you are willing to provide one is another issue!

#131

Jeremy - November 21, 2008 - 14:15

After exchanging emails offline, I've filed an issue again requesting that Chris Cohen get CVS access.

#132

asak - November 21, 2008 - 19:00

@Chris:

Using your files from comment #122 with a fresh Ads 5.x 1.6, i can happily create a flash ad - but can't get the link to work.

If i understand correctly, the link i specify in "Destination URL" should be the link for that ad. should i put the link in the .swf file as well? or is this some kind of bug? or mis-understanding?

#133

chris.cohen - November 24, 2008 - 09:04

asak, the destination URL you specify is put into the "flashvars" that are passed to the embedded flash file, as a "clickTag". Your .swf file needs to be set up to accept a clickTag. Most commercial advertising banners are set up this way. Although I don't create flash files myself, if you search the web for it, you'll come across a tutorial or step-by-step guide, I'm sure!

#134

chris.cohen - December 4, 2008 - 11:56
Status:postponed» closed

This is now a module. Thanks to everyone who offered to donate money to improve this module. Please make a donation at the Drupal Association!

#135

Jeremy - December 4, 2008 - 12:55

Thank you for taking the lead on this, Chris!

#136

xamount - December 4, 2008 - 19:53

great job Chris! I have not tested it out as yet but i will at a later date. I have already contributed to the drupal association a few months back....I won't mind send you the $25 I promised directly for doing this work. How do i do that?

#137

soundboy89 - December 4, 2008 - 23:00

#90 is the winning number, thanks so much.

#138

chris.cohen - December 5, 2008 - 09:06

xamount, thanks for the generosity but my motivation for adopting the project isn't personal profit! If you're still keen to contribute, any help testing the module would be great!

#139

OFF - February 27, 2009 - 20:21

http://drupal.org/node/364913

This is a working version ad_flash 6.x

 
 

Drupal is a registered trademark of Dries Buytaert.