Re: replace width/height values in youtube script
hi, just wondering if anyone had some ideas on how to do the above function? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323096 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: replace width/height values in youtube script
ok, i have made an attempt at converting a php function. unfortunately it does not quite work. i think i am close ?? cffunction name=resize_markup access=public returntype=string output=false cfargument name=markup type=string required=yes cfargument name=width type=numeric required=false cfargument name=height type=numeric required=false cfset var patterns = arrayNew(1) cfset var replacements = arrayNew(1) cfif isDefined(arguments.width) cfscript pattern = 'width=([0-9]+)'; arrayAppend(patterns, pattern); pattern = 'width:([0-9]+)'; arrayAppend(patterns, pattern); replacement = 'width=' arguments.width ''; arrayAppend(replacements, replacement); replacement = 'width:' arguments.width; arrayAppend(replacements, replacement); /cfscript /cfif cfif isDefined(arguments.height) cfscript pattern = 'height=([0-9]+)'; arrayAppend(patterns, pattern); pattern = 'height:([0-9]+)'; arrayAppend(patterns, pattern); replacement = 'height=' arguments.height ''; arrayAppend(replacements, replacement); replacement = 'height:' arguments.height; arrayAppend(replacements, replacement); /cfscript /cfif cfloop from=1 to=#arrayLen(patterns)# index=idx cfset new_string = REReplaceNoCase(arguments.markup, patterns[idx], replacements[idx], All) /cfloop cfreturn new_string / /cffunction ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323102 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: replace width/height values in youtube script
ah i found the prob. put this at top of function: cfset var new_string = arguments.markup and the rereplace becomes: cfset new_string = REReplaceNoCase(new_string, '#patterns[idx]#', '#replacements[idx]#', 'All') ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323104 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
replace width/height values in youtube script
hey guys, developing an app that the user inputs the embed script from a youtube video. what i want however, is for all width= and height= attributes to be replaced with custom values that fit our site layout. just a little lost as how to do this with a regular expression. any help will be greatly appreciated. mike ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322458 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4