I thought this would be a handy mod.
This will add a thumbnail version into your html instead of the full image, and the thumbnail version will also link to new image in full screen. You need to be using the mcpuk connector though (the one that creates thumbnails when your browse server)
as always BACKUP your working fckeditor folder before modifying.
Add in the option to auto thumbnail inside of fck_image.html (there may be a point where you dont want this to happen. Find the follow code in fck_image.html
<option fckLang="DlgImgAlignTop" value="top">Top</option>
</select> </td>
</tr>
Below that add this
<tr>
<td nowrap>Use Thumbnail </td>
<td><input name="chkThumb" type="checkbox" id="chkThumb" value="checkbox" checked>
</td>
</tr>
Inside of fck_image\fck_image.js replace the OK function and updateimage function with the ones I have below.
function Ok()
{
if ( GetE('txtUrl').value.length == 0 )
{
window.parent.SetSelectedTab( 'Info' ) ;
GetE('txtUrl').focus() ;
alert( FCKLang.DlgImgAlertUrl ) ;
return false ;
}
var bHasImage = ( oImage != null ) ;
if ( bHasImage && bImageButton && oImage.tagName == 'IMG' )
{
if ( confirm( 'Do you want to transform the selected image on a image button?' ) )
oImage = null ;
}
else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' )
{
if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) )
oImage = null ;
}
if ( !bHasImage )
{
if ( bImageButton )
{
oImage = FCK.EditorDocument.createElement( 'INPUT' ) ;
oImage.type = 'image' ;
oImage = FCK.InsertElementAndGetIt( oImage ) ;
}
else
oImage = FCK.CreateElement( 'IMG' ) ;
}
else
oEditor.FCKUndo.SaveUndoStep() ;
UpdateImage( oImage ) ;
var sLnkUrl = GetE('txtLnkUrl').value.trim();
if ( sLnkUrl.length == 0 )
{
if ( oLink ) {
FCK.ExecuteNamedCommand( 'Unlink' ) ;
}
else if (chkThumb.checked) {
oEditor.FCKSelection.SelectNode( oImage ) ;
asdf = oImage.src.split("/")
asdf[asdf.length -1] = asdf[asdf.length -1].replace(".thumb_", "");
oLink = oEditor.FCK.CreateLink( asdf.join("/") ) ;
SetAttribute( oLink, 'target', '_blank' ) ;
}
}
else
{
if ( oLink ) // Modifying an existent link.
oLink.href = sLnkUrl ;
else // Creating a new link.
{
if ( !bHasImage )
oEditor.FCKSelection.SelectNode( oImage ) ;
oLink = oEditor.FCK.CreateLink( sLnkUrl ) ;
if ( !bHasImage )
{
oEditor.FCKSelection.SelectNode( oLink ) ;
oEditor.FCKSelection.Collapse( false ) ;
}
}
SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ;
}
return true ;
}
function UpdateImage( e, skipId )
{
e.src = GetE('txtUrl').value;
asdf = e.src.split("/");
filename = e.src.split("/")[e.src.split("/").length - 1];
asdf.pop();
if (chkThumb.checked && filename.search(".thumb_") == -1) {
thumbname = (asdf.join("/") + '/.thumb_' + filename);
e.src = thumbname;
SetAttribute( e, "width" , '' ) ;
SetAttribute( e, "height", '' ) ;
} else {
SetAttribute( e, "width" , GetE('txtWidth').value ) ;
SetAttribute( e, "height", GetE('txtHeight').value ) ;
}
SetAttribute( e, "alt" , GetE('txtAlt').value ) ;
SetAttribute( e, "vspace", GetE('txtVSpace').value ) ;
SetAttribute( e, "hspace", GetE('txtHSpace').value ) ;
SetAttribute( e, "border", GetE('txtBorder').value ) ;
SetAttribute( e, "align" , GetE('cmbAlign').value ) ;
// Advances Attributes
if ( ! skipId )
SetAttribute( e, 'id', GetE('txtAttId').value ) ;
SetAttribute( e, 'dir' , GetE('cmbAttLangDir').value ) ;
SetAttribute( e, 'lang' , GetE('txtAttLangCode').value ) ;
SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ;
SetAttribute( e, 'class' , GetE('txtAttClasses').value ) ;
SetAttribute( e, 'longDesc' , GetE('txtLongDesc').value ) ;
if ( oEditor.FCKBrowserInfo.IsIE )
e.style.cssText = GetE('txtAttStyle').value ;
else
SetAttribute( e, 'style', GetE('txtAttStyle').value ) ;
}
I hope this helps some people, the preview can get buggy sometimes, though I've never saw the usefullness of the preview window when you pick a file to upload. And when you delete the image when you edit it leaves the empty <a></a> tags, but who cares
Fri, 12/16/2005 - 04:27
#1
RE: WORKING auto-thumbnail link to new window