Tutorial: How to add on special effect for your photography photo

Learn something new in photoshop today and would like to share with people who know my existence XD. This tutorial gives an idea on how some images bring fantastic effects on their photograph. I will demonstrate an example below,

1. Fire up your photoshop and open any scene images you have and click Edit->Define Pattern, give it a name.

untitled116

2. Now we have a new pattern we will open up another photo we want to give this effect to and on the Layer Palette look for the icon 'Add a layer style' and choose Pattern Overlay.

untitled117

3. Now, choose the new pattern that you have define and play with the opacity and scale bar until it gets you something like this.

untitled118

Of course you can get a lot more effect than the one shown above, play around with the mode and you might just get what you want.

untitled119

The key point here is to use different texture found in our real world and apply it on the image itself to produce different effects. (google is your friend) Here are some example,

untitled120

In order to fully bring out this effect, we need to have a pattern which has a similar size as the image or else it won't be as good as expected. I am just showing how this effects can bring it to certain images but this kind of technique can also apply to different type of design such as buttons, background image,photography, etc.

Tutorial: How to produce the grey out effect using javascript and css

When i surf the net and saw all these fantastic feature where the screen went black-out when a user click certain link or button always makes me wonder how does it actually work? But i always do not have the time and knowledge to understand these things since my css knowledge has always been at the basic stage where understanding of it is just too little for me due to the working time that always occupate me. Recently, i have quit my job and went back to school which leaves me with a lot of space time. This has given me the chance to pump up my knowledge on css which i'm always weak in since the starting of my web programming. i would like to show my appreciation to the author of Hunlock who produce a great tutorial on this topic.

if you have a chance to visit Hunlock tutorial, you will see the above code that he wrote for this method to work. The technique to make the screen black-out is entirely depending on the CSS. What the above code does is to create a div tag just after the body tag which already have all the css rule appended into this particular div tag. But it is being hidden until a trigger occurs and turn the flag to true to display it out.

Originally, the background color of this particular div tag should be black entirely. However, with the introduction of alpha and opacity, it gives the background a feel of transparency. While the div is treated as a block level when its triggered and position at the top left hand side with the height and width being defined in the javascript, the whole screen will be occupant by the effect. The z-index will lift the div tag by z-axis (upwards) and anything below it will be covered by the black-out effect and whenever user tries to click anything below it, it will be disabled due to z-index and display:block.

function grayOut(vis, options, extra) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page		
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
		
	var msgnode = document.createElement('div');           // Create the box layer.
		msgnode.style.position='fixed';                 // Position fixed
        msgnode.style.display='none';                      // Start out Hidden
        msgnode.id='box';                   				// Name it so we can find it later
		// give it a size and align it to center
		msgnode.style.width = "300px";
		msgnode.style.height = "300px";
		msgnode.style.marginLeft= "-150px";      
		msgnode.style.marginTop= "-150px"; 
		msgnode.style.textAlign = 'center';
		msgnode.style.top= "50%";                           // In the top	
		msgnode.style.left="50%";                          // Left corner of the page	
	tbody.appendChild(msgnode);                            // Add it to the grey screen
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
        var pageHeight = document.body.scrollHeight+'px';
    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    }   
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';  
	if(extra == 'Y')
		document.body.style.overflow =  'hidden';
		
	document.getElementById("box").style.zIndex = zindex+10;
	document.getElementById("box").style.border = "#000 solid 1px";
	document.getElementById("box").style.display = "block";
		

	document.getElementById("box").onclick = function() //attach a event handler to hide both div
	{
		dark.style.display="none";
		document.getElementById("box").style.display = "none";
		document.body.style.overflow = 'auto';
		
	}
	document.getElementById("box").style.backgroundColor="#FFF";  
	document.getElementById("box").innerHTML = "This is a box. Click me to exit effect.";
  } else {
     dark.style.display='none';
  }
}

However, user will still be able to use the scroll bar. This can be solve by adding this code

<span class="pun">document.body.style.overflow =  'hidden';
</span>

this will disable scrolling and cause the content to stay still. Depending on your need, the code produce by Hunlock can be alter accordingly.

test5 to test~

update: 27 June 2009****

I have changed the method above to include a box when the grey out appeared and a event handler attached with it so that it can be easily return back to its original form when clicked. Apologize if i did not make this update clean enough as i sort of made a quick update on it in order to answer Sanynn question below.

update: 12 July 2009*****

Update the method so that the box is align on the center, in order to align the box on the center when using position absolute, you must reset the four corner to 0 and margin to auto. Having problem aligning the box to center? Solve your problem easily with align center with CSS

update: 25 July 2009*****
If you are using jQuery, you may want to visit Simple Grey-Out Screen Effect with jQuery This article shows a complete grey out effect and how it can be done easily with just few lines of codes.

update: 24 September 2009*****
Updated the script so that the box will follow the scroll bar. The key is to position it 'fixed' and remember to placed up the DTD such as the one show below

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

If not IE won't align center. That's all! 🙂

Free Web Hosting

i was quite surprise with web hosting nowadays. Although free web hosting has been around for quite sometime, but there will always be ads banner or certain restriction that will link on your site because the service is free. Nowadays, there isn't any ads and the service provided and is equally comparable with the service given by paid hosting! Furthermore, it's TOTALLY FREE! (ah..its better than paid hosting in my country =/)

i went to google it up and found quite a few free hosting chart that show list of free hosting services. However, the same things happen with free web hosting which i though only happen with paid hosting is that there are many bad quality service although their marketing strategy looks very attractive. The 'bad' quality i am referring here is the number of downtime and their terms and condition that users do not read. Most of these free attractive hosting plans have terms which will cause your site to be removed. Some even cause your site to be down for a week/month/year because they do not really care about what happen to your site since its free. Thus, finding good quality free hosting is important if you want your site to remain alive and don't feel con after all the work you have done to get your hosting up.

Personally, i do not know any free hosting site that may worth to try but i do believe the following site may hold some interest for those who are searching desperate for it:

  1. http://www.000webhost.com/
  2. http://www.110mb.com/

Seriously, i am not doing any affiliate program for the above site. (if i am, it will be a link instead of a site url) I believe if you come in this topic and this site you are most likely someone i know or desperate for a hosting plan. If you would like to share your hosting experience with everyone, please post it up here so that people are aware.  But if you are looking for a paid hosting plan i will have an idea and if you guys really like to know, you can email me if you want to or leave a post =)

Cheers,

Clay Lua

Tutorial: How to write or design in chalk with this two technique

1. Fire up your photoshop and open up a workspace, change the background to a color where it fit the color of a blackboard(#33463a)

untitled108

2. Create a new layer and mess up the blackboard so that it look like one! This can be done by using the smudge tool and some line drawn on the board. I used 1 line with a Smudge strength of 89% and a large enough pixel for me to swing continuously on the board to create a nice effect as shown below.

untitled110

untitled109

3. Use the Horizontal Type Tools with color (#d7d7d7) and write something on the blackboard. Next, Rasterize it.

untitled111

4. Now, use the Smudge tool and rub the text until you get an effect which feel like a chalk.

untitled113

5. Finally, add some blur to it by doing this, Filter->Blur->Gaussian Blur, 2.5 Radius.

untitled112

OR

if you would like a nice drawing that looks like a chalk drawn you can do this,

1. Create a new layer and draw a bubble shape in the same color as shown above and contract it by 10px then color it with the blackboard color as shown below,

untitled114

2. Next, take the Eraser tool and adjust its opacity to 50% and start erasing the shape until you get something like this. You can duplicate this image before applying Eraser tool to retry again for a better effect.

untitled115

Done!

Tutorial: How to add button image to a link with css

I got an image from the tutorial i wrote previous and wanted to do some simple stuff like adding it to a link so i did the following css code:

a.button {
display: block; 					/* this make it possible to hook the image to the link */
background-color: transparent;
background-image: url(mybutton.png); /*set the button image */
background-repeat: no-repeat;		/*set it once only */
width: 150px;						/*width of the image*/
height: 65px;						/*height of the image*/
margin: 5px auto;					/*align the text to center with top and bottom 5px margin*/
padding: 15px 0 0 0;				/*add a padding of 15px to the top*/
text-align: center;					/*this is required to make it align to center but we usually place this on the body instead*/
font-family: Myriad Pro, Calibri, Arial, sans-serif;/*font of the image*/
font-size: 100%;									/*font size*/
color: #FFF;										/*font color*/
font-weight: bold;									/*font style*/
text-decoration: none;								/*remove the link decoration*/
}

The code is well commented for understanding and you can find the sample code from here here. You will get something like this in HTML,

untitled107