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)

By aev - April 15, 2010

Hi,

I assume the wysiwyg field is set up to use the "Resize images larger than" image for it's "Large" image and Thumbnail 1 for it's "Small" image.

Can we change this to use only "thumbnails" for both "Large" and "Small", like thumb1 for large and thumb2 for small.

This way we can set the "Resize images larger than" to a larger size than the wysiwyg's "Large" image. This is very useful if changing the design/layout of a site and we need new a "Large" size. We can than simply change the thumb1 size – no uploads required! [sly]

-aev-

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