List Info

Thread: RE: Photo galleries and the Upload API




RE: Photo galleries and the Upload API
user name
2007-09-05 10:41:44
Ok, folks -- here's a complete solution. You can see it
running here:

http://www.figleaf
.com/imgtest.cfm

Enjoy!
Steve Drucker
CEO
Fig Leaf Software
www.figleaf.com
http://training.figleaf.c
om



<!--- start code here --->

<cfscript>
	
	function imgExtract(ctext) {

		
		var found = 1;
		var startpos = 1;
		var alinks = arraynew(1);
		var sturl = "";
		var stID = "";
		
		while (found) {
		    // find anchor tags
			st=refindnocase('<img
([^>]*)([^/])>',ctext,startpos,"true");
			if (st.pos[1] is 0) {
				found = 0;
			} else {
				// grab full text of tag
				cLink = mid(ctext,st.pos[1],st.len[1]);
				
				stLink = structnew();
				stLink.tag =
mid(ctext,st.pos[1],st.len[1]);
				
				// get URL (if any)
				sturl =
refindnocase('src="([^"]*)"',stLink.tag,1,&qu
ot;true")
;
				if (stURL.pos[1] gt 0) {
					stLink.url =
mid(stlink.tag,stURL.pos[2],stURL.len[2]);
				} else {
					stLink.url="";
				}
				
				// get ID (if any)
				stID =
refindnocase('id=["]*([a-zA-Z0-9_./:?&=-|]+)
["]*
',stLink.tag,1,"true");
				if (stid.pos[1] gt 0) {
					stLink.ID = mid(stlink.tag,
stid.pos[1], stid.len[1]);
				} else {
					stLink.ID = "";
				}
				arrayappend(alinks,stlink);
			
				startpos= st.pos[1] + st.len[1];
			} 
		}
		return alinks;
	}

	

</cfscript> 

<cfset aImages =
imgExtract("#attributes.elementinfo.elementdata.textblo
ck#")>


<cfoutput>
#attributes.elementinfo.icon_elementprops##attributes.elemen
tinfo.icon_edit#
#attributes.elementinfo.icon_approve#
</cfoutput>

<cfoutput>
<script language="JavaScript">
	<cfwddx action="cfml2js"
input="#aImages#"
toplevelvariable="aImages">
	var cImage = 0;
	function displayimage(i) {
		cImage+=i;
		if (cImage >= aImages.length) 
			cImage = 0;
		if (cImage < 0) 
			cImage = aImages.length - 1;
		document.images["swapimage"].src =
aImages[cImage].url;
		
	}
</script>



<div><img name="swapimage"
src="#aImages[1].url#"
border="0"></div>

<a
href="javascript:displayimage(-1)">Previous<
/a>
<a
href="javascript:displayimage(1)">Next</a>
;
</cfoutput>



_______________________________________________
Commonspotchattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/commonspot


Brought to you by Fig Leaf Software
Premier Authorized Paperthin Consulting and Training
http://www.figleaf.com
http://training.figleaf.c
om

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )