Use only thumbnails for both "Large" and "Small" image inside a wysiwyg field

3 posts by 3 authors in: Forums > CMS Builder
Last Post: April 15, 2010   (RSS)

Re: [aev] Use only thumbnails for both "Large" and "Small" image inside a wysiwyg field

By Jason - April 15, 2010

Hi,

The wysiwyg editor is actually a 3rd party editor called tiny mce, so I'm not sure we can change how it handles image sizes. However, you can always edit an images dimensions to make it larger or smaller.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [aev] Use only thumbnails for both "Large" and "Small" image inside a wysiwyg field

By Dave - April 15, 2010

Hi aev,

I had a look and it turned out it wasn't that hard to add that, so it will be in the next beta. Here's the code if you want to update it yourself:

- Edit: cmsAdmin/lib/menus/default/uploadForm_functions.php

- And replace the _showLinks() function with this code:
//
function _showLinks($row) {
$filename = pathinfo($row['filePath'], PATHINFO_BASENAME);
$isImage = preg_match("/\.(gif|jpg|jpeg|png)$/i", $row['urlPath']);
$hasThumbnail = $isImage && $row['thumbUrlPath'];

// show insert | remove links
$removeUrl = "removeUpload('{$row['num']}', '" .addcslashes(htmlspecialchars($filename), '\\\''). "', this);";
print "<a href='#' onclick=\"insertUpload('" .addcslashes(htmlspecialchars($row['urlPath']), '\\\''). "', $isImage)\">" .t('Insert'). "</a> | ";
print "<a href='#' onclick=\"$removeUrl\">" .t('Delete'). "</a><br/>";

// show insert thumb links
$thumbLinks = '';
foreach (range(1,4) as $num) {
$fieldname = "thumbUrlPath" . (($num == 1) ? '' : $num);
$thumbUrlPath = $row[$fieldname];
if (!$thumbUrlPath) { continue; }
if ($thumbLinks) { $thumbLinks .= " | "; }
$thumbLinks .= " <a href='#' onclick=\"insertUpload('" .addcslashes(htmlspecialchars($thumbUrlPath), '\\\''). "', $isImage)\">$num</a>";
}
if ($thumbLinks) {
print t("Thumb:") . $thumbLinks . "<br/>";
}

// show filename
print "<div style='color: #666; padding-top: 1px'>$filename</div>";
}


Hope that helps! Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com