<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Encodez Blog &#187; Free Scripts</title>
	<atom:link href="http://encodez.com/blog/category/free-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://encodez.com/blog</link>
	<description>Computer language design is just like a stroll in the park. Jurassic Park, that is. — Larry Wall</description>
	<lastBuildDate>Thu, 22 Jul 2010 05:34:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Do it simpler : Image thumbnail and resize in PHP</title>
		<link>http://encodez.com/blog/2009/11/do-it-simpler-image-thumbnail-and-resize-php/</link>
		<comments>http://encodez.com/blog/2009/11/do-it-simpler-image-thumbnail-and-resize-php/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 07:31:37 +0000</pubDate>
		<dc:creator>Muneer Shaheed</dc:creator>
				<category><![CDATA[Free Scripts]]></category>
		<category><![CDATA[Webdevelopement]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[image resize]]></category>
		<category><![CDATA[php resize]]></category>
		<category><![CDATA[thumbnail]]></category>

		<guid isPermaLink="false">http://encodez.com/blog/?p=296</guid>
		<description><![CDATA[One of the common complex task among webdevelopers is image resizing. It is a big headach when using multiple size images in multiple pages of a single version of image. For long I was using a an script that would create one thumnail version of the image when the image is uploaded. It was not a suitable solution. Many time we will need different size of thumbnails to be used in different location and pages. ]]></description>
			<content:encoded><![CDATA[<p><img src="http://encodez.com/blog/wp-content/uploads/2009/11/resize2.jpg" alt="resize2" title="Image Resizing" width="150" height="215" class="alignleft size-full wp-image-312" /> One of the common complex task among webdevelopers is image resizing. It is a big headach when using multiple size images in multiple pages of a single version of image. For long I was using a an script that would create one thumnail version of the image when the image is uploaded. It was not a suitable solution. Many time we will need different size of thumbnails to be used in different location and pages. </p>
<p>I came across <a href="http://phpthumb.gxdlabs.com/" target="_blank" title="PHPThumb">PHPThumb</a>. It was a very much better one for me where it can deliver following types of resizing mechanism.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6032126876218296";
google_ad_slot = "8998015769";
google_ad_width = 468;
google_ad_height = 60;
google_cpa_choice = "";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<ul>
<li>adaptiveResize ($width, $height)</li>
<li>crop ($startX, $startY, $cropWidth, $cropHeight)</li>
<li>cropFromCenter ($cropWidth, $cropHeight = null)</li>
<li>resize ($maxWidth, $maxHeight)</li>
<li>resizePercent ($percent)</li>
<li>rotateImage ($direction = ‘CW’)</li>
<li>rotateImageNDegrees ($degrees)</li>
<li>save ($fileName)</li>
<li>show ()</li>
</ul>
<p>You can learn more about this script <a href="http://wiki.github.com/iselby/PHPThumb/basic-usage" target="_blank" title="Basic usage of PHPThumb">here</a></p>
<p>Well,I have written a simple script that can work with phpThumb. What it would do is, when I request for a resized version of an original image, it will check for a same resized version. If the one resized version exist, it will return the path of that. Otherwise, a new<br />
resized version will be created and saved before returning the path. This will help to use any size of thumbnail image at any time without wasting match resources.</p>
<p>The script</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;phpthumb/ThumbLib.inc.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009933; font-style: italic;">/**
* Resize the image according to the given parameter 
* 
* This funciton resize the image to the given criteria and save it 
* in a well-named subdirectory. Then the path to the image will be returnd.
* I the image exists allready with give criteria, the image path is 
* returned simply.
* 
* @param string     $image          path to the source image
* @param integer    $width          required width
* @param integer    $height         required height
* @param string     $resizeStyle    style of resizing (ADAPTIVE , CROP, 
*                                   CROPCENTER, RESIZEPERCENT, RESIZE)
* @param integer    $percent        resize percentage
* @param integer    $starX          start pixel X axis
* @param integer    $starY          start pixel Y axis
* @param integer    $quality        picture quality
* @return string                    path to the reqested resized image
* 
* @author muneer &lt;muneer@live.it&gt;
* @version 1.0
* @copyright (c) 2009 encodez solutions http://www.encodez.com
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> getResized<span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #339933;">,</span> <span style="color: #000088;">$resizeStyle</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ADAPTIVE&quot;</span><span style="color: #339933;">,</span> 
                        <span style="color: #000088;">$percent</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">,</span> <span style="color: #000088;">$starX</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$starY</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$quality</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">80</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>    
    <span style="color: #666666; font-style: italic;">/* setting file name */</span>
    <span style="color: #000088;">$fileName</span> <span style="color: #339933;">=</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">/* creating the path for the resized image */</span>
    <span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resizeStyle</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;RESIZEPERCENT&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>        
        <span style="color: #000088;">$path</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;x&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$height</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;-&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$resizeStyle</span><span style="color: #339933;">;</span>    
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$path</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$percent</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;-&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$resizeStyle</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">/* 
     * checking whether image exists with the same criteria
     * If exist return the generated path,
     * If not, create the thumnail 
    */</span> 
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span> 
            <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">/* making directory for the image if it is not exists */</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #990000;">mkdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #208080;">0777</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jpegQuality'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$quality</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        try
        <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">/* creating the  PhpThumbFactory object */</span>
            <span style="color: #000088;">$thumb</span> <span style="color: #339933;">=</span> PhpThumbFactory<span style="color: #339933;">::</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>            
        <span style="color: #009900;">&#125;</span>
        catch<span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$ex</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&lt;!-- There was an error resizing the image <span style="color: #000099; font-weight: bold;">\n</span>Source 
                Image : &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$image</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; <span style="color: #000099; font-weight: bold;">\n</span>Error : &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$ex</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; --&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resizeStyle</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;ADAPTIVE&quot;</span><span style="color: #339933;">:</span>        <span style="color: #666666; font-style: italic;">// adaptiveResize</span>
                <span style="color: #000088;">$thumb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">adaptiveResize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;CROP&quot;</span><span style="color: #339933;">:</span>            <span style="color: #666666; font-style: italic;">// crop</span>
                <span style="color: #000088;">$thumb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">crop</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$startX</span><span style="color: #339933;">,</span> <span style="color: #000088;">$startY</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;CROPCENTER&quot;</span><span style="color: #339933;">:</span>      <span style="color: #666666; font-style: italic;">// cropFromCenter</span>
                <span style="color: #000088;">$thumb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cropFromCenter</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;RESIZEPERCENT&quot;</span><span style="color: #339933;">:</span>   <span style="color: #666666; font-style: italic;">// resizePercent</span>
                <span style="color: #000088;">$thumb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resizePercent</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;RESIZE&quot;</span><span style="color: #339933;">:</span>          <span style="color: #666666; font-style: italic;">// resize</span>
                <span style="color: #000088;">$thumb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>                <span style="color: #666666; font-style: italic;">// resize</span>
                <span style="color: #000088;">$thumb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fileName</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">/* return 0 if the src image is not exists */</span>
        <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end function getResized()</span></pre></td></tr></table></div>

<p><strong><u>How to use this function?</u></strong><br />
scenario : Need a adaptive resize verion for /img/catalogue/sample1.jpg at 120px x 100px</p>
<p><strong>solution : </strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="xhtml" style="font-family:monospace;">&lt;img src=&quot;&lt;?php echo getResized(&quot;/img/catalogue/sample1.jpg&quot;, 120, 100, &quot;ADAPTIVE&quot;) ?&gt;&quot; /&gt;</pre></td></tr></table></div>

<p>This will generate a &#8220;adaptive&#8221; resized image at the size of 120 px width and 100 px height. </p>
<p>This iamge will have the path </p>
<p><strong>/img/catalogue/120&#215;100-ADAPTIVE/sample1.jpg</strong></p>
<p>This script might helpful you too. Please do not forget to put a comment if you like it Or any suggestion if you have.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6032126876218296";
google_ui_features = "rc:6";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_alternate_ad_url = "?adsensem-benice=468x60";
google_color_border = "#ffffff";
google_color_bg = "#ffffff";
google_color_link = "#333333";
google_color_text = "#666666";
google_color_url = "008000";

//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://encodez.com/blog/2009/11/do-it-simpler-image-thumbnail-and-resize-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Broblem! Flash object overlapping menus and layers in Firefox and IE</title>
		<link>http://encodez.com/blog/2009/02/solve-flash-object-overlapping-menus-and-layers-in-firefox-and-ie/</link>
		<comments>http://encodez.com/blog/2009/02/solve-flash-object-overlapping-menus-and-layers-in-firefox-and-ie/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 07:38:50 +0000</pubDate>
		<dc:creator>Muneer Shaheed</dc:creator>
				<category><![CDATA[Free Scripts]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Webdevelopement]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash overlap]]></category>

		<guid isPermaLink="false">http://www.encodez.com/blog/?p=119</guid>
		<description><![CDATA[Hi all, hopefully many of the designer will face this problem. Most possible case is dropdown menu and flash banner. Both always come near by.

To overcome this issue, there is a possible way by using the code &#60;object&#62; and &#60;embed&#62; simply. I have illustrated the code below.]]></description>
			<content:encoded><![CDATA[<p>Hi all, hopefully many of the designer will face this problem. Most possible case is dropdown menu and flash banner. Both always come near by.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6032126876218296";
google_ad_slot = "8998015769";
google_ad_width = 468;
google_ad_height = 60;
google_cpa_choice = "";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p>To overcome this issue, there is a possible way by using the code &lt;object&gt; and &lt;embed&gt; simply. I have illustrated the code below.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">object</span> <span style="color: #000066;">classid</span><span style="color: #66cc66;">=</span>clsid:D27CDB6E-AE6D-11cf-96B8-<span style="color: #cc66cc;">444553540000</span> <span style="color: #000066;">codebase</span><span style="color: #66cc66;">=</span>http:<span style="color: #66cc66;">//</span>download.macromedia.com<span style="color: #66cc66;">/</span>pub<span style="color: #66cc66;">/</span>shockwave<span style="color: #66cc66;">/</span>cabs<span style="color: #66cc66;">/</span>flash<span style="color: #66cc66;">/</span>swflash.cab#version<span style="color: #66cc66;">=</span><span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span> movie<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myEncodez.swf&quot;</span> quality<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;high&quot;</span> wmode<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;transparent&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;150&quot;</span> <span style="color: #000066;">version</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;8,0,0,0&quot;</span> <span style="color: #000066;">bgcolor</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#ffffff&quot;</span> &gt;</span>
&nbsp;
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span>movie <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myEncodez.swf&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span>quality <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;high&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span>wmode <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;transparent&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #000066;">width</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #000066;">height</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;150&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #000066;">version</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;8,0,0,0&quot;</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #000066;">bgcolor</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#ffffff&quot;</span>&gt;</span>
&nbsp;
   <span style="color: #009900;">&lt;embed <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myEncodez.swf&quot;</span> pluginspage<span style="color: #66cc66;">=</span>http:<span style="color: #66cc66;">//</span>www.macromedia.com<span style="color: #66cc66;">/</span>shockwave<span style="color: #66cc66;">/</span>download<span style="color: #66cc66;">/</span>index.cgi?P1_Prod_Version<span style="color: #66cc66;">=</span>ShockwaveFlash <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span>application<span style="color: #66cc66;">/</span>x-shockwave-flash movie<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myEncodez.swf&quot;</span> quality<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;high&quot;</span> wmode<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;transparent&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;150&quot;</span> <span style="color: #000066;">version</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;8,0,0,0&quot;</span> <span style="color: #000066;">bgcolor</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#ffffff&quot;</span> &gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>embed&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">object</span>&gt;</span></pre></td></tr></table></div>

<p>Also this is a solution for the Microsoft&#8217;s recent security update which was annoying developers and users who faced a message saying &#8220;<strong>Click to activate and use this control</strong>&#8221; in all &lt;embed&gt; and &lt;object&gt; s. More info about this security update can be found in <a href="http://msdn.microsoft.com/en-us/library/ms537508.aspx" target="_blank">here</a></p>
<p>In contrast, <a href="http://www.milonic.com/" target="_blank">Milonic </a>has released a Javascript function which does the same as above &lt;object&gt; &amp; &lt;embed&gt; tags. The code can be <a href="http://www.milonic.com/insert_active_flash.js" target="_blank">downloaded from here</a>. It is very simple to use the code rather to write full &lt;embed&gt; tag in the HTML file. Thanks to <strong>Milonic Solutions</strong>.</p>
<p><strong>How to use the Milonic&#8217;s Insert Active Flash Javascript file (insert_active_flash.js).</strong></p>
<p><strong>1. </strong><a href="http://www.milonic.com/insert_active_flash.js" target="_blank">Download </a>the file and make a reference at the header part of HTML file.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;insert_active_flash.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p><strong>2.</strong> Create a Layer using &lt;div&gt; and assign an id for that</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myFlashDiv&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p><strong>3.</strong> Use the following code withing the &#8220;myFlashDiv&#8221; layer which will be later replaced by insert_active_flash script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myFlashDiv&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
    myFlashObject=new Object
     myFlashObject.movie=&quot;flashfile.swf&quot;
     myFlashObject.quality=&quot;high&quot;
     myFlashObject.wmode=&quot;transparent&quot;
     myFlashObject.width=850
     myFlashObject.height=550
     myFlashObject.version=&quot;5,0,0,0&quot;
&nbsp;
     commitFlashObject(myFlashObject, &quot;myFlashDiv&quot;)
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>This is it. It is simple right?</p>
<p>When later the flash function execute, it will dynamically replace the above javascript code in to &lt;object&gt; code and will embed the movie using classic method. No worry for us!</p>
]]></content:encoded>
			<wfw:commentRss>http://encodez.com/blog/2009/02/solve-flash-object-overlapping-menus-and-layers-in-firefox-and-ie/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Javascript Smooth Scroller</title>
		<link>http://encodez.com/blog/2009/01/javascript-smooth-scroller/</link>
		<comments>http://encodez.com/blog/2009/01/javascript-smooth-scroller/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 10:12:51 +0000</pubDate>
		<dc:creator>Muneer Shaheed</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Free Scripts]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Webdevelopement]]></category>
		<category><![CDATA[scroller]]></category>

		<guid isPermaLink="false">http://www.encodez.com/blog/?p=92</guid>
		<description><![CDATA[I am happy to share the Javascript Scroller which I created for one of my project. Javascript Scroller has been built up with combination of CSS and Javascript. Examples : Sample 1 Sample 2 Download Link Link 1 &#8211; Link 2 Editing the width and height of Scroller It is just simple to edit the [...]]]></description>
			<content:encoded><![CDATA[<p>I am happy to share the Javascript Scroller which I created for one of my project. Javascript Scroller has been built up with combination of CSS and Javascript.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6032126876218296";
google_ad_slot = "8998015769";
google_ad_width = 468;
google_ad_height = 60;
google_cpa_choice = "";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<table border="0">
<tbody>
<tr>
<td align="left" valign="top">
<div id="attachment_94" class="wp-caption alignnone" style="width: 209px"><img class="size-full wp-image-94" title="Javascript Smooth Scroller" src="http://www.encodez.com/blog/wp-content/uploads/2009/01/scroller1.jpg" alt="Scroller Preview" width="199" height="582" /><br />
<p class="wp-caption-text">Scroller Preview 1</p></div></td>
<td align="left" valign="top">
<p><div id="attachment_96" class="wp-caption alignnone" style="width: 314px"><img class="size-full wp-image-96" title="Javascript Smooth Scroller" src="http://www.encodez.com/blog/wp-content/uploads/2009/01/news-image-2.jpg" alt="Preview" width="304" height="352" /><p class="wp-caption-text">Scroller Preview 2</p></div></td>
</tr>
</tbody>
</table>
<h3>Examples :</h3>
<ol>
<li><a title="Javascript Smooth Scroller - Sample 1" href="http://encodez.com/demos/Javascript_smooth_scroller_i.html" target="_blank">Sample 1</a></li>
<li><a title="Javascript Smooth Scroller - Sample 2" href="http://encodez.com/demos/Javascript_smooth_scroller_ii.html" target="_blank">Sample 2</a></li>
</ol>
<h3>Download Link</h3>
<p><a title="Download Javascript Smooth Scroller" href="http://www.encodez.com/downloads/javascript_smooth_scroller/javascript smooth scroller.zip" target="_blank"><strong>Link 1</strong></a> &#8211;   <strong>Link 2</strong></p>
<p><div id="attachment_103" class="wp-caption aligncenter" style="width: 360px"><img class="size-full wp-image-103" title="Compatibility with almost all browsers" src="http://www.encodez.com/blog/wp-content/uploads/2009/01/all-browser-compatible-smoo.gif" alt="Browser compatibility" width="350" height="200" /><p class="wp-caption-text">Browser compatibility</p></div>
<h3>Editing the width and height of Scroller</h3>
<p>It is just simple to edit the size or any other style of Smooth Scroller.</p>
<p><strong>CSS to change</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#encFilmMain</span>
<span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">160px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* full width */</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#encFilm</span>
<span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* height */</span>
   <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span> <span style="color: #933;">5px</span> <span style="color: #933;">5px</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#encFilmInner</span>
<span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#efefef</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span> <span style="color: #933;">5px</span> <span style="color: #933;">5px</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">290px</span><span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/* height */</span>
   <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p><strong>Javascript to change</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> scrollAmount<span style="color: #339933;">=</span><span style="color: #CC0000;">240</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">// scroll amount</span>
<span style="color: #003366; font-weight: bold;">var</span> barHeight<span style="color: #339933;">=</span><span style="color: #CC0000;">290</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">//height</span></pre></td></tr></table></div>

<p>If you like or you have any doubts, please do not forget to leave your comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://encodez.com/blog/2009/01/javascript-smooth-scroller/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>
