close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Resize by max width & height

Thread began 10/13/2010 4:42 am by neilo | Last modified 10/14/2010 8:32 pm by neilo | 1977 views | 10 replies

Ray BorduinWebAssist

I think we may not have thought of the scenario you are trying to use it in, so no standard implementation will work as you are intending.

I may be able to come up with a solution, but I need to understand it a little better.

How will the client be adding images after you have finished creating the page? Through HTML editor and then stored in the database in a column?

This isn't actually directly supported, since we never thought of this use case, but I can probably find a solution for you with a little hand coding.

So you are placing a database column reference in that "content goes here" area?

I think what you could do is add an image resizer image into the content area... Then delete the image placeholder and put your database column reference using "proportion to box" with "resize smaller images" unchecked.

Then add this function to the page:

function setImgWidths($imageContent,$width)  {
preg_match_all("/(<img\s*[^>]*?".">)/" , $imageContent, $imageMatches);
foreach($imageMatches[1] as $imgTag){
$origImg = $imgTag;
if(preg_match("/width\s*=\s*(['\"])([^'\"]*)\\1/i", $imgTag)){
$imgTag = preg_replace("/width\s*=\s*(['\"])([^'\"]*)\\1/i", "width=\"$width\"", $imgTag);
} else {
$imgTag = "<img width=\"$width\"" . substr($imgTag,4);
}
$imageContent = str_replace($origImg, $imgTag, $imageContent);
}
return $imageContent;
}



and use it to change all of the widths of the images by wrapping it around your recordset column reference like:

setImgWidths($row_Recordset['contentColumn'],200);

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...