Does this module support flash (swf) files?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jeremy’s picture

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.)

liquidcms’s picture

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

reed.r’s picture

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.

Jeremy’s picture

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.

reed.r’s picture

FileSize
5.66 KB

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

liquidcms’s picture

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.

reed.r’s picture

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):

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.

Jeremy’s picture

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?

fax8’s picture

Title: Flash files? » Developing a flash plugin for ad module
Component: ad.module » plug-in development
Assigned: Unassigned » 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

Jeremy’s picture

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.

Boris Mann’s picture

Great stuff. Watching :P

chrishaff’s picture

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...

fax8’s picture

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.

fax8’s picture

Version: 5.x-1.x-dev » 5.x-1.0-1
Status: Active » Needs review
FileSize
10.8 KB

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

bsonnich’s picture

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.

bsonnich’s picture

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.

Jeremy’s picture

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.

fax8’s picture

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

$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

jgonzalez-1’s picture

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

dasil003’s picture

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

Jeremy’s picture

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.

fax8’s picture

Status: Needs review » Needs work
FileSize
21.27 KB

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

fax8’s picture

FileSize
21.23 KB

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

fax8’s picture

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

Jeremy’s picture

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?

fax8’s picture

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

fax8’s picture

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

$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).

Jeremy’s picture

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.

lazly’s picture

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!

lazly’s picture

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!

sliiiiiide’s picture

subscribing!

lazly’s picture

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!

Delta Bridges’s picture

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,

rudins’s picture

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" />

Jose Reyero’s picture

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.

eotinfotech’s picture

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

  $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

Anonymous’s picture

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.

mixman’s picture

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

Jeremy’s picture

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?

mixman’s picture

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).

Jeremy’s picture

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.

mixman’s picture

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

mixman’s picture

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?

Jeremy’s picture

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.

mixman’s picture

Assigned: fax8 » mixman

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

Garrett Albright’s picture

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.

mixman’s picture

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...

Garrett Albright’s picture

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

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…

mixman’s picture

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 ;-)

capitano83’s picture

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

Garrett Albright’s picture

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?

jsaints’s picture

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

mixman’s picture

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.

sliiiiiide’s picture

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

mixman’s picture

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.

sliiiiiide’s picture

Title: Developing a flash plugin for the ad module » Developing a flash plugin for ad module
Component: ad module » ad_flash.module
Status: Closed (fixed) » Needs work

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

mixman’s picture

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

mixman’s picture

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

real1st’s picture

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

Delta Bridges’s picture

Yes, working well :)

Jack_Sparrow’s picture

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?

Dries Arnolds’s picture

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?

pierrelord’s picture

Category: feature » 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!

Anonymous’s picture

Same here.

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

Jack_Sparrow’s picture

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

mixman’s picture

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.

danthalian’s picture

Subscribing

danthalian’s picture

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 :(

Anonymous’s picture

Category: task » bug
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!

chavalina’s picture

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?

jim_at_miramontes’s picture

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?

yngens’s picture

i confirm this error

jim_at_miramontes’s picture

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.

jim_at_miramontes’s picture

Component: ad_flash module » ad_flash.module
Category: feature » bug
Priority: Normal » Critical
Status: Needs work » Active

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?

ncameron’s picture

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

attb2’s picture

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:

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

Category: bug » feature
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.

Anonymous’s picture

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.

rolandk’s picture

Component: ad_flash.module » ad_flash module
Category: bug » feature
Priority: Critical » Normal
Status: Active » Needs work

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

Anonymous’s picture

@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.

Jeremy’s picture

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?

asak’s picture

subscribing

fax8’s picture

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.

Jeremy’s picture

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.

druvision’s picture

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 :)

beekay1076’s picture

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;
}
druclogs’s picture

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

druclogs’s picture

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

gordns’s picture

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

Thanks!

aether’s picture

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.

dortez’s picture

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

bevinlorenzo’s picture

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?

Jeremy’s picture

Status: Needs work » Closed (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.

Dries Arnolds’s picture

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?

Jeremy’s picture

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.

reed.richards’s picture

FileSize
570.88 KB

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

Animatour’s picture

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

MM-Steven’s picture

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..

reed.richards’s picture

FileSize
570.92 KB

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.

ahoms’s picture

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

Ehud’s picture

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!

elvis2’s picture

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?

yhager’s picture

the module in #99 caused a duplicate function error for ad_flash_views_tables, I had to put the views inclusion code within 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"

:-)

rak’s picture

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

cerber0s’s picture

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?
Delta Bridges’s picture

$15 for me too :)

Ehud’s picture

You can count me in.

asak’s picture

I'm in.

rak’s picture

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

Jeremy’s picture

Title: so... is anybody taking the project or not ? » Developing a flash plugin for the ad module
Status: Closed (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.

amfis’s picture

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.

bighead03’s picture

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

reed.richards’s picture

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.

rak’s picture

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

rak’s picture

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

Delta Bridges’s picture

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

Einkahumor’s picture

Subscribe.

I'm in for the $15 donation thing.

TimeFor’s picture

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';
    }
  }
}

xamount’s picture

subscribing

AdamGerthel’s picture

subscribing

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

chriscohen’s picture

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.

chriscohen’s picture

FileSize
570.37 KB

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.

xamount’s picture

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...

drupalnuts’s picture

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)

drjonez’s picture

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

triversedesigns’s picture

$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.

LynnS’s picture

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

drjonez’s picture

I'll pitch in $3,584.4 Zimbabwe dollars

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

Seriously, this module NEEDS the flash :)

Jeremy’s picture

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.

chriscohen’s picture

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!

Jeremy’s picture

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

asak’s picture

@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?

chriscohen’s picture

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!

chriscohen’s picture

Status: Postponed » Closed (fixed)

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!

Jeremy’s picture

Thank you for taking the lead on this, Chris!

xamount’s picture

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?

soundboy89’s picture

#90 is the winning number, thanks so much.

chriscohen’s picture

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!

OFF’s picture

http://drupal.org/node/364913

This is a working version ad_flash 6.x

Alex Andrascu’s picture

Component: ad_flash module » ad module

There is now an activelly developed official Ad Flash module for 6.x
http://drupal.org/project/ad_flash

Status: Needs work » Closed (fixed)