Lucee 5.3.8 CFChart URL Disable - coldfusion
Lucee CFChart type pie from query markup:
<cfchart chartheight="600" chartwidth="800" showborder="true" title="Levels">
<cfchartseries query="#layout.querymap[layout.QueryName]#" type="pie" itemcolumn="Title" valuecolumn="Amount" />
</cfchart>
creates this HTML:
<map id="chart_8" name="chart_8">
<area shape="poly" coords="211,170,225,147,242,126,262,108,284,93,307,80,333,71,359,66,386,64,386,263,386,263" title="84000" alt="" href="#?series=0&category=xxxx&value=84000.0"/>
<area shape="poly" coords="176,278,178,254,182,230,189,208,199,186,374,278,374,278" title="37500" alt="" href="#?series=0&category=xxxx&value=37500.0"/>
<area shape="poly" coords="275,468,254,453,235,436,218,416,204,395,193,372,185,348,180,323,179,297,377,297,377,297" title="80000" alt="" href="#?series=0&category=xxxx&value=80000.0"/>
<area shape="poly" coords="516,471,491,487,465,498,437,505,409,509,380,508,352,503,325,494,299,481,401,310,401,310" title="90000" alt="" href="#?series=0&category=xxxx&value=90000.0"/>
<area shape="poly" coords="610,359,598,388,581,416,561,440,536,461,420,300,420,300" title="50000" alt="" href="#?series=0&category=xxxx&value=50000.0"/>
<area shape="poly" coords="588,168,600,188,610,208,617,229,621,251,623,273,623,296,620,318,614,340,425,281,425,281" title="70000" alt="" href="#?series=0&category=xxxx&value=70000.0"/>
<area shape="poly" coords="412,63,436,65,459,69,482,76,504,86,524,99,543,113,560,130,575,149,412,262,412,262" title="75000" alt="" href="#?series=0&category=xxxx&value=75000.0"/>
</map><img border="0" usemap="#chart_8" src="/lucee/graph.cfm?img=f09a50705458509f66c5f37628f0bdea&type=png">
I want the static image alone; no href links, no area tags, no map tags.
An empty url attribute doesn't work; a documentation search was futile.
Use the source attribute of cfchart. It will store the src attribute of the generated image in the specified variable.
<cfchart source="myChartImage" ...>
<cfchartseries ...>
</cfchart>
<cfdump var="#myChartImage#">
Using your example, myChartImage would be a string with a value of /lucee/graph.cfm?img=f09a50705458509f66c5f37628f0bdea&type=png.
If you want to store the generated chart image as an actual file without calling /lucee/graph.cfm, you need to request the URI via cfhttp using the getAsBinary attribute and retrieve the data as byte array. You can then write it to disk or encode it as base64 or hex etc.
#Alex - thank you! This produces bare img tag I want:
<cfchart chartheight="600" chartwidth="800" showborder="true" title="Levels" source="imagesource">
<cfchartseries query="#layout.querymap[layout.QueryName]#" type="pie" itemcolumn="Title" valuecolumn="DonationAmount" />
</cfchart><cfoutput>
<img src="#imagesource#">
</cfoutput>
Related
ColdFusion - CFDOCUMENT Title in URL
I am creating a PDF document using ColdFusion cfdocument tag. Works fine, however instead of showing the document name in browser Title - it shows the .cfc file that I call to create the PDF. Here is how I'm calling it. <cfdocument format="pdf" marginbottom=".5" margintop=".25" marginright=".5" marginleft=".5" saveAsName="#filename#.pdf"> <cfdocumentitem type="footer"> <p style="font-size:11px; text-align:right; font-style:italic;">Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#</p> </cfdocumentitem> <html> <head><title>#filename#.pdf</title></head> <body><img src="file:///#application.tempFolder#\#thisFilename#" /></body> </html> </cfdocument> What the heck am I missing? Why does it still show the filename.cfc file that I'm calling in the browser title instead of the filename I give to the PDF???
Figured it out. Had to create the document using CFDOCUMENT, then add a "Title" attribute to it using the CFPDF tag. Then output it to the browser. <!--- Create the PDF ---> <cfdocument format="pdf" marginbottom=".5" margintop=".25" marginright=".5" marginleft=".5" filename="#application.tempFolder#\#thisSaveAsFilename#" overwrite="yes"> <cfdocumentitem type="footer"> <p style="font-size:11px; text-align:right; font-style:italic;">Page #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#</p> </cfdocumentitem> <html> <head><title>#thisSaveAsFilename#</title></head> <body><img src="file:///#application.tempFolder#\#thisFilename#" /></body> </html> </cfdocument> <!--- Use CFPDF to add attributes to it ---> <cfset thisInfo = StructNew()> <cfset thisInfo.Title = "pdf title goes here..."> <cfpdf action="setinfo" info="#thisInfo#" source="#application.tempFolder#\#thisSaveAsFilename#" /> <!--- Send it to the browser ---> <cfcontent file="#application.tempFolder#\#thisSaveAsFilename#" type="application/pdf" />A
Default to "Browse" tab when selecting images from Media Library?
When browsing for an image from an Image field in Sitecore 7, is it possible to default to the "Browse" tab as opposed to the new "Search" tab? The new search functionality is great for advanced users, however, my content authors are finding it confusing, especially with multiple languages showing up in the results. Selecting a search result item also yields an error in some cases, so I'd just like to disable it at this point.
on this file \sitecore\shell\Applications\Media\MediaBrowser\MediaBrowser.xml you need to change order of the tabs : You will have : <Tabstrip ID="Tabs" Width="100%" Height="471px"> <Tab ID="MediaLibraryTab" Header="Browse" Height="100%"> <GridPanel Width="100%" Height="100%" Style="table-layout:fixed" Columns="3" GridPanel.Height="100%"> <Scrollbox Height="100%" Class="scScrollbox scFixSize scFixSize8" Background="white" Padding="0px" GridPanel.Height="100%" GridPanel.Width="200" GridPanel.VAlign="top" Style="overflow:auto"> <TreeviewEx ID="Treeview" DataContext="MediaDataContext" Click="SelectTreeNode" DblClick="TreeViewDblClick" ShowRoot="true" ContextMenu='Treeview.GetContextMenu("contextmenu")' Width="100%" /> </Scrollbox> <VSplitter ID="MediaBrowserLeft" Target="left" GridPanel.Width="4" /> <Scrollbox ID="Listview" Width="100%" Height="100%" Class="scScrollbox scFixSize scFixSize8" Background="white" Padding="0px" GridPanel.Height="100%" GridPanel.Width="100%" GridPanel.VAlign="top" /> </GridPanel> </Tab> <Tab ID="MediaTab" Header="Search" Height="100%"> <Frame SourceUri="/sitecore/shell/Applications/Buckets/MediaBrowser.aspx" Width="100%" Height="100%"></Frame> </Tab> </Tabstrip> instead of : <Tabstrip ID="Tabs" Width="100%" Height="471px"> <Tab ID="MediaTab" Header="Search" Height="100%"> <Frame SourceUri="/sitecore/shell/Applications/Buckets/MediaBrowser.aspx" Width="100%" Height="100%"></Frame> </Tab> <Tab ID="MediaLibraryTab" Header="Browse" Height="100%"> <GridPanel Width="100%" Height="100%" Style="table-layout:fixed" Columns="3" GridPanel.Height="100%"> <Scrollbox Height="100%" Class="scScrollbox scFixSize scFixSize8" Background="white" Padding="0px" GridPanel.Height="100%" GridPanel.Width="200" GridPanel.VAlign="top" Style="overflow:auto"> <TreeviewEx ID="Treeview" DataContext="MediaDataContext" Click="SelectTreeNode" DblClick="TreeViewDblClick" ShowRoot="true" ContextMenu='Treeview.GetContextMenu("contextmenu")' Width="100%" /> </Scrollbox> <VSplitter ID="MediaBrowserLeft" Target="left" GridPanel.Width="4" /> <Scrollbox ID="Listview" Width="100%" Height="100%" Class="scScrollbox scFixSize scFixSize8" Background="white" Padding="0px" GridPanel.Height="100%" GridPanel.Width="100%" GridPanel.VAlign="top" /> </GridPanel> </Tab> </Tabstrip> You just change the order of tag TAB .
If you are using the Media Browser in the new Speak UI (available in Sitecore 7.?) you can accomplish the same thing by doing the following: In the /App_Config/Include/Sitecore.Speak.config file replace the line: <override xmlControl="Sitecore.Shell.Applications.Media.MediaBrowser" with="/sitecore/client/applications/Dialogs/SelectMediaDialog" /> with the line: <override xmlControl="Sitecore.Shell.Applications.Media.MediaBrowser" with="/sitecore/client/applications/Dialogs/SelectMediaViaTreeDialog" /> Thanks Sitecore Support for the instructions.
In jquery-cycle2 when using data-cycle-fx="none" I see the previous image beneath the old one before it changes
I have this img slideshow that changes when I click. I would like no effects when the image change, like it used to be in the old jquery-cycle, but instead I get a strange effect of 2 images overlapping each others until the second one finally appear and the first then disappear. <div class="imgCyclerBody"> <div><img class="sortArrow" src="~/Content/imgs/arrow-left.png" alt="left"/></div> <div id="slideshow" class="cycle-slideshow" data-cycle-fx="none" data-cycle-hide-non-active="true" data-cycle-prev=".prev" data-cycle-next=".next"> <img alt="Item" src="~/Content/imgs/image1.png" width="30" height="30" /> <img alt="Item" src="~/Content/imgs/image2.png" width="30" height="30" /> <img alt="Item" src="~/Content/imgs/image3.png" width="30" height="30" /> <img alt="Item" src="~/Content/imgs/image4.png" width="30" height="30" /> <img alt="Item" src="~/Content/imgs/Pixels.png" width="30" height="30" /> </div> <div><img class="sortArrow" src="~/Content/imgs/arrow-right.png" alt="right"/></div> </div> Does anybody knows how to avoid this problem? I moved from the old jquery-cycle to the new one becaue I had a problem with my DIVs format when I used fx: 'none'. Thanks
Have you tried using the easing plugin? This doesn't appear to be having an issue on my fiddle. <div class="cycle-slideshow" data-cycle-slides="li" data-cycle-fx='none' data-cycle-speed='700' data-cycle-timeout='7000' data-cycle-pause-on-hover="true" data-cycle-prev=".prev" data-cycle-next=".next" data-cycle-easing="easeOutBack" >
Coldfusion - Simple HTML Parsing
We currently have some articles that get posted onto our site. they can appear with the following types of html <p>this is an article<br> <img src="someimage"> </p> <p>this is an article<br> <img src="someimage"> </p> <p>this is an article<br> <img src="someimage"> </p> <p>this is an article<br> <img src="someimage"> </p> or <p><img src="someimage"> this is an article<br> </p> <p>this is an article<br> <img src="someimage"> </p> <p><img src="someimage"> this is an article<br> </p> Some other html tags may be inside this sometimes, I cant get my head around how to scrape the page using coldfusion to achieve this Esentially what i need to do is grab hold of the first paragraph text and image and be able to arrange it. Is this possible using Coldfusion 8 ? Would anyone be able to point me in the direction on how to learn this ?
100% definitely possible! Now, don't be put off by what I'm going to suggest, it's actually very easy to get going with this. Download a library called jSoup...it's sole purpose is for scraping contents from the DOM in a web page: http://jsoup.org/ You would then use this Java class by doing something like: <!--- Get the page. ---> <cfhttp method="get" url="http://example.com/" resolveurl="true" useragent="#cgi.http_user_agent#" result="myPage" timeout="10" charset="utf-8"> <cfhttpparam type="header" name="Accept-Encoding" value="*" /> <cfhttpparam type="header" name="TE" value="deflate;q=0" /> </cfhttp> <!--- Load up jSoup and parse the document with it. ---> <cfset jsoup = createObject("java", "org.jsoup.Jsoup") /> <cfset document = jsoup.parse(myPage.filecontent) /> <!--- Search the parsed document for the contents of the TITLE tag. ---> <cfset title = document.select("title").first() /> <!--- Let's see what we got. ---> <cfdump var="#title#" /> This example is pretty simple but it can show you just how easy it is to work with. Scraping images and whatever else would be fairly easy if you check out the docs on jSoup. There are some good examples on this page, where you can use CSS style selectors: http://jsoup.org/cookbook/extracting-data/selector-syntax Try to avoid using Regex for this task - believe me, I've tried and it's an absolute can of worms! Hope this helps. Mikey.
Using cfpdf to display pdf files
I have a page where I need to display a pdf and an "I agree" button. Q: Do I use cfpdf to create a thumbnail of the pdf and display the resulting output? Chapter 32 of cfWack 8 talks about using cfpdf.
I did this in the office once...It's not that sweet as it's presented in Adobe's whitepapers. Here's my code: <cfpdf source="#attachmentFilePath##attachmentFilename#" pages="1" imagePrefix="#prefix#" action="thumbnail" destination="#application.attachmentsFilePath#/_thumbs" format="jpg" overwrite="true" resolution="low" scale="80"> <cfset thumbURL = "http://127.0.0.1:9001/attachments/_thumbs/#prefix#_page_1.jpg"> <cfif fileExists(thumb)> <tr> <td width="100%"> <a href="attachmentView.cfm?attachNo=#attachNo#&act=download"> <img alt="#attachmentFilename#" src="#thumbURL#" width="500" /> </a> </td> </tr> <cfelse> <cfheader name="Content-Type" value="#attachmentMIMEType#"> <cfheader name="Content-Disposition" value="attachment; filename=#attachmentFilename#"> <cfcontent type="#attachmentMIMEType#" file="#attachmentFilePath##attachmentFilename#"> </cfif> I also check isPDF() and putting all this in try/catch. So what's wrong with this? It works with 30% of PDF users are trying to preview so in catch I display link for download instead of image :(