This script works fine. The issue I'm having is trying to get it to generate multiple barcodes per page. It will only generate the first one. the rest are blank images.
<cfoutput>
<cfset x = 0>
<cfloop index="price_tag" from="1" to="#arrayLen( session.tags )#">
<cfset x = x + 1>
<cfscript>
code128= createobject("java","com.lowagie.text.pdf.Barcode128");
code128.setCodeType(code128.CODE128);
/* Set the code to generate */
code128.setCode("#Session.tags[price_tag].itemnum#");
color = createobject("java","java.awt.Color");
image = code128.createAwtImage(color.black, color.white);
bufferedImage = createObject("java", "java.awt.image.BufferedImage");
bufferedImageType = bufferedImage.TYPE_BYTE_GRAY;
bufferedImage = bufferedImage.init(image.getWidth(JavaCast("null", "")),image.getHeight(JavaCast("null", "")), bufferedImageType);
graphics2D = bufferedImage.createGraphics();
graphics2D.drawImage(image,0,0,JavaCast("null", ""));
barcodeImage = imageNew(bufferedImage);
</cfscript>
<div style="margin:0px; padding:0px;">
<div style="font-size:42px; font-weight:bold; margin-bottom:0px; margin-right: 10px; margin-top: -5px;">#Session.tags[price_tag].item_name#</div>
<div style="font-size:32px; margin-bottom:0px; margin-top:-7px; margin-right: 10px;">#Session.tags[price_tag].item_brand#</div>
<div style="font-size:24px; margin-bottom:0px; margin-top:-7px;">#Session.tags[price_tag].item_unit_size# #Session.tags[price_tag].item_unit_type# </div>
<div style="font-size:120px; font-weight:bolder; margin-top:-55px; margin-right: 10px;" align="right">#DollarFormat(Session.tags[price_tag].item_retail)#</div>
<div style="font-size:30px; font-weight:bolder; margin-top:-30px; margin-right: 10px;" align="right"> #Session.tags[price_tag].item_sold_by#</div>
<div style="font-size:30px; margin-top:-35px; margin-left 10px;" align="left">#Session.tags[price_tag].itemnum#</div>
<div style=" position:absolute; margin-left: 10px; margin-top: 100px;"><cfimage action="writeToBrowser" source="#barcodeImage#" format="png" quality="1" width="180px" overwrite = "yes"></div>
</div>
<cfif #arrayLen( session.tags )# / #x# NEQ 1>
<cfdocumentitem type="pagebreak"/>
</cfif>
</cfloop>
</cfoutput>
It's probably because you are using action="writeToBrowser" in a loop within cfdocument. It's not going to a browser.
Try writing real files, then linking to them. I've done that and know it works. Make sure you use a distinct file name in that loop.
If you plan to run this routine over and over, it's safe to use the same file names. But in your code disable caching of the image src with a url var:
<cfoutput>
<img src="/media/cms/code-#price_tag#.png?rand=#randRange(0,1000)#" width="180"/>
</cfoutput>
Related
I followed the django-recaptcha directions to add a field to my contact form. When it renders (in my local test), it has a field that says "Captcha:" but no actual captcha rendered. The dev console in chrome says
Uncaught Error: Missing required parameters: sitekey
in https://www.gstatic.com/recaptcha/api2/v1531759913576/recaptcha__en.js
This answer says to add render=explicit to the javascript, but a) I'm not sure that's even the problem, b) I would think the Django package would handle it.
Django 1.11.8, Django recaptcha 1.4.0.
Django form is
class ContactForm(forms.Form):
contacter = forms.EmailField(required=True,
label=_('Your Email (optional)'),
widget=forms.widgets.TextInput(
attrs={'size': '50'}))
contact_text = forms.CharField(required=True,
widget=forms.widgets.Textarea(
attrs={'rows': '10',
'cols': '70',
'class': 'defaultText',
'title':
_('Type a message here')}))
captcha = ReCaptchaField()
The rendered Django form is below.
<form action="/contact/"
method="post" id="new-contact">
<input type='hidden' name='csrfmiddlewaretoken' value='...' />
<fieldset id="contact">
<legend>Contact Us</legend>
<tr><th><label for="id_contacter">Your Email (optional):</label></th><td><input type="text" name="contacter" required id="id_contacter" size="50" /></td></tr>
<tr><th><label for="id_contact_text">Contact text:</label></th><td><textarea name="contact_text" rows="10" title="Type a message here" id="id_contact_text" required cols="70" class="defaultText">
</textarea></td></tr>
<tr><th><label for="id_captcha">Captcha:</label></th><td><script src="https://www.google.com/recaptcha/api.js?hl=en"></script>
<div class="g-recaptcha" data-sitekey="" data-required="True" data-id="id_captcha" ></div>
<noscript>
<div style="width: 302px; height: 352px;">
<div style="width: 302px; height: 352px; position: relative;">
<div style="width: 302px; height: 352px; position: absolute;">
<iframe src="https://www.google.com/recaptcha/api/fallback?k="
frameborder="0" scrolling="no"
style="width: 302px; height:352px; border-style: none;">
</iframe>
</div>
<div style="width: 250px; height: 80px; position: absolute; border-style: none;
bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">
<textarea id="g-recaptcha-response" name="g-recaptcha-response"
class="recaptcha_challenge_field"
style="width: 250px; height: 80px; border: 1px solid #c1c1c1;
margin: 0px; padding: 0px; resize: none;" value="">
</textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge" />
</div>
</div>
</div>
</noscript></td></tr>
</fieldset>
<input type="submit" value="Submit" />
</form>
I also filed this issue here.
Setting RECAPTCHA_PRIVATE_KEY and RECAPTCHA_PUBLIC_KEY to empty strings as directed produces this error. If instead those variables are completely unset (in the Django settings for the dev environment), the library uses the test keys, and all is well.
I have output from a table that I want highlighted should a certain requirement not be met. I have it working fine for one section, but then when I use the code on a QofQ after an inner join of two tables, it doesn't work.
I can see when I dump the variables that they are correct and I know 100% that one of the companies contains no negative data so should display correctly but both companies are displaying in red.
I'm obviously not seeing something or does QofQ have limitations that are causing this ?
I'm still learning so please be kind :)
Queries :
<cfquery name="suppNeg" datasource="users">
SELECT companies.subID, companies.companyID, companies.suppName
, suppresult_old.companyID, suppresult_old.O18, suppresult_old.O19
, suppresult_old.O20, suppresult_old.O22, suppresult_old.WDPVC1
, suppresult_old.WDPVC2, quarterID
FROM suppresult_old INNER JOIN companies
ON suppresult_old.companyID=companies.companyID
WHERE quarterID = 8
AND companies.subID = #session.auth.companyID#
ORDER BY companies.suppName ASC
</cfquery>
<cfquery dbtype="query" name="subs">
SELECT DISTINCT suppName, companyID, subID
FROM suppNeg
ORDER BY suppName ASC
</cfquery>
<cfquery name="columntotals" datasource="users">
SELECT O18,O19,O20,O22, WDPVC1, WDPVC2
FROM suppresult_old INNER JOIN companies
ON suppresult_old.companyID=companies.companyID
WHERE quarterID = 8
AND companies.subID = #session.auth.companyID#
</cfquery>
<cfset O18Value = valueList(columntotals.O18) />
<cfset O18total = listToArray(O18Value) />
<cfset O19Value = valueList(columntotals.O19) />
<cfset O19total = listToArray(O19Value) />
<cfset O20Value = valueList(columntotals.O20) />
<cfset O20total = listToArray(O20Value) />
<cfset O22Value = valueList(columntotals.O22) />
<cfset O22total = listToArray(O22Value) />
<cfset WDPVC1Value = valueList(columntotals.WDPVC1) />
<cfset WDPVC1total = listToArray(WDPVC1Value) />
<cfset WDPVC2Value = valueList(columntotals.WDPVC2) />
<cfset WDPVC2total = listToArray(WDPVC2Value) />
<cfquery name="suppliers" datasource="users">
SELECT suppName, companyID, subID
FROM companies
WHERE subID=#session.auth.companyID#
ORDER BY suppName ASC
</cfquery>
Output :
<cfoutput query="subs">
<div class="container" width="1100">
<div class="row">
<a href="2tierReport.cfm?quarterID=8&companyID=#companyID#">
<cfif (arraysum(O18total)) LT 0>
<div class ="col-sm-4 supphighlight1">
<h4>
<span class="glyphicon glyphicon-exclamation-sign" style="color:##ffffff; font-size: 32px; vertical-align: middle;" aria-hidden="true"></span><strong> #subs.suppName#</strong></a>
</h4>
</div>
</a>
<a href="2tierReport.cfm?quarterID=8&companyID=#companyID#">
<cfelseif (arraysum(O19total)) LT 0>
<div class ="col-sm-4 supphighlight1">
<h4>
<span class="glyphicon glyphicon-exclamation-sign" style="color:##ffffff; font-size: 32px; vertical-align: middle;" aria-hidden="true"></span><strong> #subs.suppName#</strong>
</h4>
</div>
</a>
<a href="2tierReport.cfm?quarterID=8&companyID=#companyID#">
<cfelseif (arraysum(O20total)) LT 0>
<div class ="col-sm-4 supphighlight1">
<h4>
<span class="glyphicon glyphicon-exclamation-sign" style="color:##ffffff; font-size: 32px; vertical-align: middle;" aria-hidden="true"></span><strong> #subs.suppName#</strong>
</h4>
</div>
</a>
<a href="2tierReport.cfm?quarterID=8&companyID=#companyID#">
<cfelseif (arraysum(O22total)) lt 0>
<div class ="col-sm-4 supphighlight1">
<h4>
<span class="glyphicon glyphicon-exclamation-sign" style="color:##ffffff; font-size: 32px; vertical-align: middle;" aria-hidden="true"></span><strong> #subs.suppName#</strong>
</h4>
</div>
</a>
<a href="2tierReport.cfm?quarterID=8&companyID=#companyID#">
<cfelseif (arraysum(WDPVC1total)) LT 0>
<div class ="col-sm-4 supphighlight1">
<h4>
<span class="glyphicon glyphicon-exclamation-sign" style="color:##ffffff; font-size: 32px; vertical-align: middle;" aria-hidden="true"></span><strong> #subs.suppName#</strong>
</h4>
</div>
</a>
<a href="2tierReport.cfm?quarterID=8&companyID=#companyID#">
<cfelseif (arraysum(WDPVC2total)) LT 0>
<div class ="col-sm-4 supphighlight1">
<h4>
<span class="glyphicon glyphicon-exclamation-sign" style="color:##ffffff; font-size: 32px; vertical-align: middle;" aria-hidden="true"></span><strong> #subs.suppName#</strong>
</h4>
</div>
</a>
<cfelse>
<a href="suppReports_admin.cfm?quarterID=8&companyID=#companyID#">
<div class ="col-sm-4 supphighlight">
<h4>
<span class="glyphicon glyphicon-ok-circle" style="color:##ffffff; font-size: 32px; vertical-align: middle;" aria-hidden="true"></span><strong> #subs.suppName#</strong>
</h4>
</div>
</a>
....
That's a lot to digest, without any data samples, but I'll take a stab at it :) I think the problem is that the code is comparing apples and oranges. The "sub" query contains the details for individual companies and subId's. (I've no idea what the real data looks like, so the samples below are just for illustration)
However, the cfif comparisons calculate the overall total for all companies and subId's. So if the overall total for O20 (O18, etc..) is negative, then it'll be negative for every company in the cfoutput.
Runnable TryCF.com Example
If all you want is the totals, by companyId and subId, it's much easier to calculate that in SQL. Instead of all the ValueList(), ArraySum() and QoQ's, use the SQL aggregate function SUM(). I don't know which DBMS you're using, but something like this should work in most any database:
Note: I "guessed" that quarterID is a column in the suppresult_old table
<!--- NOT TESTED --->
<cfquery name="totalsByCompany" datasource="users">
SELECT companies.subID
, companies.companyID
, companies.suppName
, suppresult_old.quarterID
, SUM(suppresult_old.O18) AS O18Total
, SUM(suppresult_old.O19) AS O19Total
, SUM(suppresult_old.O20) AS O20Total
, SUM(suppresult_old.O22) AS O22Total
, SUM(suppresult_old.WDPVC1) AS WDPVC1Total
, SUM(suppresult_old.WDPVC2) AS WDPVC2Total
FROM suppresult_old
INNER JOIN companies ON suppresult_old.companyID=companies.companyID
WHERE suppresult_old.quarterID = 8
AND companies.subID= <cfqueryparam value="#session.auth.companyID#" cfsqltype="cf_sql_integer">
GROUP BY companies.subID
, companies.companyID
, companies.suppName
, suppresult_old.quarterID
ORDER BY companies.suppName ASC
</cfquery>
Then in your cfoutput, use the calculated SUM's:
<cfoutput query="totalsByCompany">
....
<cfif O18total LT 0> .... code here
<cfelseif O19total LT 0>.... code here
<cfelse> ...
</cfif>
</cfoutput>
Aside: If you're new to S.O., might want to take a gander at How to create a Minimal, Complete, and Verifiable example. Putting together (the smallest possible) self-contained example demonstrating the problem makes it a LOT easier for others to assist, and less likely the question will be closed as too broad :) Also, tools like https://trycf.com and https://sqlfiddle.com are great for sharing runnable examples.
Disclaimer, I'm a ColdFusion newbie...
I'm using Mura CMS 6, and I've got a question with regards to accessing a custom attribute.
My contentRenderer.cfc file has code for a Bootstrap Carousel. I'd like to be able to output the contents of a custom attribute on the file that the carousel is using, but I'm not entirely sure how to do that.
My custom attribute is named 'imageLink', but I have no idea how to get the current context to be able to output the contents of this attribute to the screen.
The following code is the code for the carousel (I didn't write it)
<cfsavecontent variable="local.str"><cfoutput>
<!--- BEGIN: Bootstrap Carousel --->
<!--- IMPORTANT: This will only output items that have associated images --->
<cfset local.feed = variables.$.getBean('feed').loadBy(name=arguments.feedName)>
<cfset local.iterator = local.feed.getIterator()>
<cfif local.feed.getIsNew()>
<div class="container">
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert"><i class="fa fa-remove"></i></button>
<h4>Ooops!</h4>
The <strong>#HTMLEditFormat(arguments.feedName)#</strong> Content Collection/Local Index does not exist.
</div>
</div>
<cfelseif local.iterator.hasNext()>
<div id="#arguments.cssID#" class="carousel slide" data-interval="#arguments.interval#">
<!--- Indicators --->
<cfif arguments.showIndicators>
<ol class="carousel-indicators">
<cfset local.iterator.reset()>
<cfset local.idx = 0>
<cfloop condition="local.iterator.hasNext()">
<cfset local.item=iterator.next()>
<cfif ListFindNoCase('jpg,jpeg,gif,png', ListLast(local.item.getImageURL(), '.'))>
<li data-target="###arguments.cssID#" data-slide-to="#idx#" class="<cfif local.idx eq 0>active</cfif>"></li>
<cfset local.idx++>
</cfif>
</cfloop>
</ol>
</cfif>
<!--- Wrapper for slides --->
<div class="carousel-inner" role="listbox">
<cfset local.iterator.reset()>
<cfset local.idx = 0>
<cfloop condition="local.iterator.hasNext()">
<cfset local.item=iterator.next()>
<cfif ListFindNoCase('jpg,jpeg,gif,png', ListLast(local.item.getImageURL(), '.'))>
<div class="item<cfif local.idx eq 0> active</cfif>">
<img src="#local.item.getImageURL(argumentCollection=local.imageArgs)#" alt="#HTMLEditFormat(local.item.getTitle())#">
<cfif arguments.showCaption>
<div class="container">
<div class="carousel-caption">
<h2>#HTMLEditFormat(local.item.getTitle())#</h2>
#local.item.getTitle()#
<!-- <p><a class="btn btn-larg btn-primary" href="#local.item.getURL()#">Read More</a></p>-->
</div>
</div>
</cfif>
</div>
<cfset local.idx++>
</cfif>
</cfloop>
</div>
<cfif local.idx>
<!--- Controls --->
<cfif local.idx gt 1>
<a class="left carousel-control" href="###arguments.cssID#" data-slide="prev" role="button">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="###arguments.cssID#" data-slide="next" role="button">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<!--- AutoStart --->
<cfif arguments.autoStart>
<script>jQuery(document).ready(function($){$('###arguments.cssID#').carousel({interval:#arguments.interval#});});</script>
</cfif>
</cfif>
<cfelse>
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert"><i class="fa fa-remove"></i></button>
<h4>Oh snap!</h4>
Your feed has no items <em>with images</em>.
</div>
</cfif>
</div>
<cfelse>
<div class="alert alert-info alert-block">
<button type="button" class="close" data-dismiss="alert"><i class="fa fa-remove"></i></button>
<h4>Heads up!</h4>
Your feed has no items.
</div>
</cfif>
<!--- // END: Bootstrap Carousel --->
</cfoutput></cfsavecontent>
How can I access the current context to output that attribute?
Here are the docs on how to display them.
http://docs.getmura.com/v6/back-end/class-extension-manager/displaying-extended-attributes/
It looks like you looping through a collection of content so I believe this would work.
#local.item.get("imageLink")#
Assuming you are working within the cfloop and after the line
<cfset local.item=iterator.next()>
You can get your custom imageLink value using
#local.item.getImageLink()#
or
#local.item.getValue('imageLink')#
Hey guys i am stuck at a point .I have a situation where i need to upload the scaled image in different folder for example :- 1(small).jpg on small folder , 1(medium).jpg on medium folder and 1.jpg on uploads folder. Right now the code below is uploading all 3 images on different folders but the files are blob files.How to get the scaled image . (edited the code)
<cfset destinationDirectory = expandpath('/file_uploader/uploads')>
<cfset counter = 1>
<cfset uniqueFileName = "">
<cfset destinationFilePath = "">
<cfset smallfile = "">
<cfset mediumfile ="">
<cfset mainfile= ''>
<cfscript>
variables.validMimeTypes = {'image/jpeg': {extension: 'jpg'}
,'image/png': {extension: 'png'}
,'image/png': {extension: 'gif'}
}; </cfscript>
<cftry>
<cfset cnt= 1>
<cfset file_name = #qqfilename#>
<cfset file_size = #qqtotalfilesize#>
<!--- If a file with the same name already exists at the destination --->
<cfif fileExists(destinationDirectory & "/" & file_name)>
<!--- Loop up to 100 times to try create a unique file_name --->
<cfset destinationFilePath = destinationDirectory & "/" & counter & "_" & file_name>
<!--- Loop up to 100 times to try create a unique filename --->
<cfloop condition="counter LT 100">
<cfset destinationFilePath = destinationDirectory & "/" & counter & "_" & file_name>
<cfif fileExists(destinationFilePath)>
<cfset counter++>
<cfelse>
<cfset uniqueFileName = "IMG" & counter & "_" & file_name>
<cfbreak/>
</cfif>
</cfloop>
<!--- Filename does not already exist at the destination --->
<cfelse>
<cfset uniqueFileName = "IMG" & "_" & file_name>
<cfset destinationFilePath = destinationDirectory & "/" & file_name>
</cfif>
<cfif len(trim(uniqueFileName))>
<cfset session.cntr ++>
<cfif find("(small)",file_name) neq 0>
<cfset smallfile = file_name>
<cffile
action="upload"
destination="#UploadPath2#"
accept="#StructKeyList(variables.validMimeTypes)#"
nameconflict="#smallfile#"
>
<cfelseif find("(medium)",file_name) neq 0>
<cfset mediumfile = file_name>
<cffile
action="upload"
filefield="qqfile"
destination="#UploadPath1#"
accept="#StructKeyList(variables.validMimeTypes)#"
nameconflict="#uniqueFileName#"
>
<cfelse>
<cfset mainfile= file_name>
<cffile
action="upload"
filefield="qqfile"
destination="#destinationFilePath#"
accept="#StructKeyList(variables.validMimeTypes)#"
nameconflict="#uniqueFileName#"
>
</cfif>
<CFSET local.response['success'] = true >
<CFSET local.response['type'] = 'xhr' >
<CFSET local.response['obj'] = session.cntr >
<cfelse>
<CFSET local.response['error'] = 'Unable to move the file and create a unique file_name at the destination'>
</cfif>
<cfoutput>
#serializeJSON(local.response,true)#
</cfoutput>
<cfabort/>
<cfcatch type="any">
<cfoutput> #serializeJSON(session.cntr,true)# </cfoutput>
<cfabort/>
</cfcatch> </cftry>
below is the UI page
<!DOCTYPE html> <html> <head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- jQuery
====================================================================== -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Fine Uploader Gallery CSS file
====================================================================== -->
<link href="../file_uploader/includes/fine-uploader-gallery.css" rel="stylesheet">
<!-- Fine Uploader JS file
====================================================================== -->
<script src="../file_uploader/includes/all.fine-uploader.js"></script>
<script src="../file_uploader/includes/all.fine-uploader.min.js"></script>
<script src="../file_uploader/includes/jquery.fine-uploader.js"></script>
<script src="../file_uploader/includes/jquery.fine-uploader.min.js"></script>
<!-- Fine Uploader Gallery template
====================================================================== -->
<script type="text/template" id="qq-template-gallery">
<div class="qq-uploader-selector qq-uploader qq-gallery" qq-drop-area-text="Drop files here">
<div class="qq-total-progress-bar-container-selector qq-total-progress-bar-container">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-total-progress-bar-selector qq-progress-bar qq-total-progress-bar"></div>
</div>
<div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
<span class="qq-upload-drop-area-text-selector"></span>
</div>
<div class="qq-upload-button-selector qq-upload-button">
<div>Upload a file </div>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span>Processing dropped files...</span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list-selector qq-upload-list" role="region" aria-live="polite" aria-relevant="additions removals">
<li>
<span role="status" class="qq-upload-status-text-selector qq-upload-status-text"></span>
<div class="qq-progress-bar-container-selector qq-progress-bar-container">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<div class="qq-thumbnail-wrapper">
<img class="qq-thumbnail-selector" qq-max-size="120" qq-server-scale>
</div>
<button type="button" class="qq-upload-cancel-selector qq-upload-cancel">X</button>
<button type="button" class="qq-upload-retry-selector qq-upload-retry">
<span class="qq-btn qq-retry-icon" aria-label="Retry"></span>
Retry
</button>
<div class="qq-file-info">
<div class="qq-file-name">
<span class="qq-upload-file-selector qq-upload-file"></span>
<span class="qq-edit-filename-icon-selector qq-edit-filename-icon" aria-label="Edit filename"></span>
</div>
<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
<span class="qq-upload-size-selector qq-upload-size"></span>
<button type="button" class="qq-btn qq-upload-delete-selector qq-upload-delete">
<span class="qq-btn qq-delete-icon" aria-label="Delete"></span>
</button>
<button type="button" class="qq-btn qq-upload-pause-selector qq-upload-pause">
<span class="qq-btn qq-pause-icon" aria-label="Pause"></span>
</button>
<button type="button" class="qq-btn qq-upload-continue-selector qq-upload-continue">
<span class="qq-btn qq-continue-icon" aria-label="Continue"></span>
</button>
</div>
</li>
</ul>
<dialog class="qq-alert-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">Close</button>
</div>
</dialog>
<dialog class="qq-confirm-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">No</button>
<button type="button" class="qq-ok-button-selector">Yes</button>
</div>
</dialog>
<dialog class="qq-prompt-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<input type="text">
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">Cancel</button>
<button type="button" class="qq-ok-button-selector">Ok</button>
</div>
</dialog>
</div>
</script>
<title>Fine Uploader Gallery View Demo</title> </head> <body>
<!-- Fine Uploader DOM Element
====================================================================== -->
<div id="fine-uploader-gallery"></div>
<!-- Your code to create an instance of Fine Uploader and bind to the DOM/template
====================================================================== -->
<script> var posturl = "../file_uploader/upload_file.cfm"; var t= 0;
var galleryUploader = new qq.FineUploader({
element: document.getElementById("fine-uploader-gallery"),
//debug: true,
autoUpload: false,
template: 'qq-template-gallery',
request:
{
// endpoint: '../file_uploader/upload_file.cfm?id=<cfoutput>#session.cntr#</cfoutput>'
endpoint: posturl
},
thumbnails:
{
placeholders:
{
waitingPath: '../file_uploader/includes/placeholders/waiting-generic.png',
notAvailablePath: '../file_uploader/includes/placeholders/not_available-generic.png'
}
},
validation:
{
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png']
},
callbacks: {
onComplete: function(id, name, responseJSON , xhrOrXdr)
{
if (responseJSON.success)
{
t++;
alert("success"+t);
uploadSuccess: {
endpoint: "../file_uploader/upload_file.cfm?id=1"
}
}
},
onError: function(id, name, errorReason, xhrOrXdr)
{
alert(qq.format("Error on file number {} - {}. Reason: {}", id, name, errorReason));
}
},
scaling:
{
//hideScaled: true,
sizes:
[
{name: "small", maxSize: 100},
{name: "medium", maxSize: 300}
]
}
});
</script> </body> </html>
There are at least two ways to determine the scaled size of an image. One way would be to look for the appropriate prefix in the image's file name. For example, if you've instructed Fine Uploader to include the phrase "small", then you should look for the string "(small)" in the file name server-side. The same goes for any other size prefix you have specified in your scaling options.
Another option would be to look at the actual size of the files in a scaling group. Each scaled file in a group will contain a qqparentuuid request parameter pointing to the UUID of the original image/file. Once you have all of these files, you can examine their sizes to determine which one is small, medium, large, etc.
I highly suggest using the first option.
I am relatively new on Railo. Trying to set up an application on “Railo” I had encountered a problem with PDF generation. Notice I run the app on Adobe CFML Server with no problem.
The problem: Somewhere in my app I have a button that fetches data from a database and serves a downloadable PDF file. On Railo server the PDF content is returned with “funny characters”. The output language is Greek. Greek language has many accented characters. And that’s where the problem occurs (accented characters returned in a “funny” format e.g. Ÿ for ή or Š for O or OΕ’ for Ά). I think the problem is related to Railo’s fonts collection. The same manifests on openBD server!
I have already tried adding cfprocessingdirective pageEncoding="utf-8" in the cfm file with no results. I have tried to add fonts in the fonts.jar (this is under \WEB-INF\lib folder) with no results also (and the call the fonts in the PDF css).
I don’t want to use Adobe CFML Server anymore.
Is there any solution on this issue?
Many thanks in advance,
Tom
Greece
The cfc just serves data from the database
The code I am using:
<cfprocessingdirective pageEncoding="utf-8">
<cfif not IsDefined("URL.id")>
<cfelseif not IsDefined("URL.model")>
<cfelseif not IsDefined("URL.title")>
<cfelseif not IsDefined("URL.id_tree")>
</cfif>
<cfheader name="Content-Disposition" value="attachment; filename=#URL.id_tree#.pdf">
<cfcontent type="application/unknown; charset=utf-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!---<link rel="stylesheet" type="text/css" href="resources/fonts/MinionProRegular/MinionProRegular.css" charset="utf-8" />--->
<title>Print</title>
</head>
<body>
<!---<cfif not IsDefined("URL.id")>
<cfelseif not IsDefined("URL.model")>
</cfif>--->
<!--- Get print details --->
<cfinvoke
component="Print"
method="myPrint"
returnvariable="getContent"
id="#URL.id#"
model="#URL.model#">
<!---<cfdump var="#getMember#">--->
<!--- Output the PDF --->
<cfdocument
format="pdf"
pagetype="a4"
<!---pageheight="5"
pagewidth="6.5"--->
margintop="0.6"
marginbottom="0.8"
marginright="1.3"
marginleft="1"
scale="90"
unit="in"
fontembed="true"
backgroundvisible="true">
<cfoutput query="getContent" >
<style type="text/css">
.logo {
background-image:url(../../images/app-specific/ithemis_logo_NEW.png);
background-repeat: no-repeat;
display: inline-block;
float: left;
clear: right;
}
.name {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
color: ##5a5a5a;
<!---float: left;
clear: right;--->
<!---margin-top: 5px;--->
}
.body {
font-family: "Times New Roman", Times, serif;
<!---font-family: Bodoni;--->
<!---font-family: Didot;--->
<!---font-family: Greek;--->
<!---font-family: Geosanslight;--->
<!---font-family: Minionpro_regular;--->
<!---font-family: Philosopher;--->
<!---font-family: Russian;--->
font-size: 11px;
color: ##323232;
line-height: 17px;
<!---float: left;
clear: right;--->
}
.line {
font-size:1px;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: ##202020;
padding-bottom: 5px;
}
.point {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 11px;
padding: 5px 5px 5px 5px;
color: ##373737;
background-color: ##eeeeee;
/*width: 100% !important;*/
display: block !important;
text-align: justify;
}
</style>
<!---<cfprocessingdirective pageencoding="utf-8">--->
<cfdocumentitem type="header">
<img src="../../images/app-specific/ithemis_logo_print_pdf.png" alt="iThemis logo" width="80" height="30" style="float:left;" border="0"/>
</cfdocumentitem>
<!---Use a footer with current page of totalpages format. --->
<cfdocumentitem type="footer">
<cfoutput><span style="font-family:Georgia, 'Times New Roman', Times, serif;font-size:10px;color: ##5a5a5a;float:right;">Σελίδα #cfdocument.currentpagenumber# από #cfdocument.totalpagecount#</span></cfoutput>
</cfdocumentitem>
<table border="0">
<tr>
<td><span class="name">#Title#</span></td>
</tr>
<tr>
<td><span class="body">#Body#</span></td>
</tr>
</table>
</cfoutput>
</cfdocument>
</body>
</html>
Railo is different in some ways.
It is very important that the CFC / CFM file that is generating the PDF is ALSO saved in unicode format.
I recommend going to File > New in your editor and ensure that the editor allows you to define the BOM and encoding prior to creation of the file.
Then copy / paste the code into the new file and overwrite the file with it.
If you do this, it should work.
It sounds weird... but give it a shot.
It's fixed my UTF-8 apps on Railo many of times.
Dreamweaver, although I no longer use it - allowed for these settings to be defined upon file creation. You can also set them in preferences for all future documents.
On SublimeText 2, you can save a file with encoding and BOM.
In ColdFusion Builder, not sure exactly where BOM settings are located but here is a preferences pain for ensuring Default encoding is set to UTF-8.
I hope this helps you and anyone else having similar issues.
REMEMBER: If you're working with UTF-8 / Railo, you have to ensure EVERY ASPECT of the interactions are also saved with UTF-8 in mind. Including the cfc/cfm files themselves.
Good luck!
Make sure you ALSO add the <cfprocessingdirective pageencoding="utf-8"> immediately after the <cfcomponent> in your CFC.