Griffith Designs

Service

Determine IMG Scale Ratio

by webmasterjunkie on Aug.27, 2011, under Coldfusion, Internet, Programming, Web

Well, recently I had to vertically center an image in a square DIV. This had to be done with the image being scaled to a specific width, 90px. I know there are probably hundreds of ways to do this, but this is the one that I used to determine how much top margin to set on the image in order to center it vertically.

<cfobject type="JAVA" action="Create" name="tk" class="java.awt.Toolkit"></cfobject>
<cfobject type="JAVA" action="Create" name="img" class="java.awt.Image"></cfobject>
<!--- requires knowing the desired width of the image/div --->
<cfset imgDims = 90 />
<cfscript>
 imagePath = ExpandPath ("/uploads/Image/sponsors/#sm_image#");
 img = tk.getDefaultToolkit().getImage("#imagePath#");
 imgWidth = img.getWidth();
 imgHeight = img.getHeight();
 percentage = (imgDims / imgWidth) * 100;
 newHeight = round((imgHeight * percentage) / 100);
 margin = (imgDims - newHeight) / 2;
</cfscript>

Continue reading “Determine IMG Scale Ratio” »

Leave a Comment :, more...

Long META Titles

by webmasterjunkie on Jul.20, 2011, under Internet, Programming, Web

It seems people and companies don’t take the world of tabbed internet browsing into consideration when titling their pages. Titles should be no more than 4 to 6 words so that it displays correctly in the tab. Especially considering the relative influence it has on their SEP. Consider UX.

Leave a Comment :, , more...

Beauty of File Naming

by webmasterjunkie on Apr.20, 2011, under Coldfusion, Designs, Internet, Programming, Service, Web

OK, there are a lot of benefits to naming the files you create when doing web design in a manner that makes sense. Recently I developed a site for a company and it was all static files with no database back-end. You can imagine that there were a lot of products and pages that had to be created as a result. When doing this I decided to go with the following convention:

category-subcategory-product-name-name.cfm

Continue reading “Beauty of File Naming” »

Leave a Comment :, , more...

Internet Explorer 9

by webmasterjunkie on Mar.23, 2011, under Internet, Web

Well, I finally got around to installing it, and I have to say that Microsoft got it right this time. Now I can debug CSS code in one browser for ie7, 8, & 9.

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Connect