Skip to content

Instantly share code, notes, and snippets.

@jsieber
Forked from stevewithington/muraSourceImage.cfm
Created May 20, 2014 04:50
Show Gist options
  • Save jsieber/7ea37b0adcff3a165bde to your computer and use it in GitHub Desktop.
Save jsieber/7ea37b0adcff3a165bde to your computer and use it in GitHub Desktop.
<!--- Add this to your /config/settings.ini.cfm --->
maxsourceimagewidth=99999
<!---
As long as the source image width is less than the value (in pixels) entered above,
then the source image will NOT be modified at all
--->
<!---
Then, you will probably want to copy the '/display_objects/gallery/' directory,
and paste it under either /display_objects/custom/gallery/ or your theme's
display_objects directory.
In the index.cfm, just after the closing </cfloop> tag, you can then add this code:
--->
<cfif Len(variables.$.getURLForImage(variables.item.getValue('fileid')))>
<cfscript>
img = variables.$.getURLForImage(
fileid = variables.item.getValue('fileid') // could be _any_ fileid in Mura
,size = 'large' // small, medium, large, custom, or any other pre-defined image size
//,width = 300 // only needed if using size='custom'
//,height = 100 // only needed if using size='custom'
,complete = false // set to true to include the entire URL, not just the absolute path (default)
,siteid = variables.$.event('siteid') // could pull an image from another siteid, if desired
);
</cfscript>
<div class="source-image">
<a target="_blank" href="#variables.$.getURLForImage(fileid=variables.item.getValue('fileid'), size='source')#" title="#HTMLEditFormat(variables.item.getValue('title'))#">
Source File
</a>
</div>
</cfif>
<!---
If you want to create a custom gallery, you could
1) go to Class Extension Manager
2) create "Gallery/SourceImage"
3) create a file called 'dsp_Gallery_SourceImage.cfm' file
4) paste it under '/display_objects/custom/extensions/' (site or theme)
5) copy the '/gallery/' directory
6) paste it under '/display_objects/custom/extensions/'
7) rename the 'gallery' directory to something like 'gallery-sourceimage'
8) include the following line of code n the 'dsp_Gallery_SourceImage.cfm' file:
--->
<cfinclude template="gallery-sourceimage/index.cfm" />
<!---
9) Then, make the modification as listed above and any other changes you wish.
--->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment