Loading
Friday, February 27, 2009

PHP Tutorial: How to resize an image by using PHP


Writing your our own php script to resize the image dynamically will control both the image size and the file size. Check out the image to the left - which was resized with a php script.

This is how do we do this. You going to make use of the PHP GD library to manipulate the image, and a $_GET parameter to tell PHP which image to re-size. First, you need to open up your main screenshot file and get it’s size and type.

$src_img = imagecreatefrompng('image.png');
$srcsize = getimagesize('image.png');


imagecreatfrompng() creates an image object and stores it in $src_image. If the file is a different type you can replace “png” with “jpeg” or “gif.” getimagesize() stores an array in $srcsize that contains the width of the image ($srcsize[0]), the height of the image ($srcsize[1]), and the filetype of the image ($srcsize[2]). Now you need to create new dimensions for the new image and actually create an image. Let's resize the screenshot to 200 pixels wide - and then adjust the height to maintain the ratio.

$dest_x = 200;
$dest_y = (200 / $srcsize[0]) * $srcsize[1];
$dst_img = imagecreatetruecolor($dest_x, $dest_y);


imagecopyresampled() copies an image ($dst_img) into a new image ($src_img) with a set of given attributes (including our sizes). The “Header” line tells the browser that this is an image - so that it’s not displayed as a bunch of gibberish. Finally, the imagepng() function actually displays the image. Now, you need to clean up and get rid of the image objects. Otherwise, you could end up eatting a lot of memory from the server.

imagedestroy($src_img);
imagedestroy($dst_img);


If you load the script directly, you should simply see the image. PHP creates an image resource and displays it in the browser - as if “resize-image.php” was really “image.png.” Therefore you need to include this new image in an HTML page is use the php script as the src attribute of our <img> tag. Like this.

<img src='resize-image.php' />

The script will execute, create an image, and use that as the src. The last thing you need to do is modify your script so that we can pass it some information. It wouldn’t any good if you had to write a new php script for every image you wanted to resize. Instead, we can use the $_GET array to ---- a variable (the image filename) to our image resizing script. Here’s the entire image resizing script, with the $_GET variable used for the filename.

// Create source image and dimensions
$src_img = imagecreatefrompng($_GET['image']);
$srcsize = getimagesize($_GET['image']);

$dest_x = 200;
$dest_y = (200 / $srcsize[0]) * $srcsize[1];

$dst_img = imagecreatetruecolor($dest_x, $dest_y);


// Resize image
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]);

// Output image
header("content-type: image/png");
imagepng($dst_img);


// Deletes images
imagedestroy($src_img);
imagedestroy($dst_img);


To use this, you need to slightly modify your HTML and add an “image” parameter to the URL of your script. Like so…

<img src='resize-image.php?image=image.png' />

Now you can resize images on the fly the way you want, and when you want.

source:code-sucks.com

Thursday, February 26, 2009

Free social bookmarking icons for bloggers


Free Social Bookmarking Icons
Web developers icon set

Web developers icon set

Web developers icon set

Web developers icon set

Web developers icon set

source:freeiconsdownload.com

Free vista style icons for web developers


Choco Sosial icons
Web developers icon set

Free Developers Icons
Web developers icon set
Web developers icon set
Web developers icon set

source:freeiconsdownload.com

10 Principles for User Interface Design


These are ten general principles for user interface design. They are called "heuristics" because they are more in the nature of rules of thumb than specific usability guidelines.

Visibility of system status
The system should always keep users informed about what is going on, through appropriate feedback within reasonable time.

Match between system and the real world
The system should speak the users' language, with words, phrases and concepts familiar to the user, rather than system-oriented terms. Follow real-world conventions, making information appear in a natural and logical order.

User control and freedom
Users often choose system functions by mistake and will need a clearly marked "emergency exit" to leave the unwanted state without having to go through an extended dialogue. Support undo and redo.

Consistency and standards
Users should not have to wonder whether different words, situations, or actions mean the same thing. Follow platform conventions.

Error prevention
Even better than good error messages is a careful design which prevents a problem from occurring in the first place. Either eliminate error-prone conditions or check for them and present users with a confirmation option before they commit to the action.

Recognition rather than recall
Minimize the user's memory load by making objects, actions, and options visible. The user should not have to remember information from one part of the dialogue to another. Instructions for use of the system should be visible or easily retrievable whenever appropriate.

Flexibility and efficiency of use
Accelerators -- unseen by the novice user -- may often speed up the interaction for the expert user such that the system can cater to both inexperienced and experienced users. Allow users to tailor frequent actions.

Aesthetic and minimalist design
Dialogues should not contain information which is irrelevant or rarely needed. Every extra unit of information in a dialogue competes with the relevant units of information and diminishes their relative visibility.

Help users recognize, diagnose, and recover from errors
Error messages should be expressed in plain language (no codes), precisely indicate the problem, and constructively suggest a solution.

Help and documentation
Even though it is better if the system can be used without documentation, it may be necessary to provide help and documentation. Any such information should be easy to search, focused on the user's task, list concrete steps to be carried out, and not be too large.

source:designingwebinterfaces.com

Monday, February 23, 2009

CSS rounded corners without using images


Before introducing CSS3 it wasn't possible to make rounded corner without using images. The Border module offers a way out, though, through the border-radius properties.

The syntax is as follows:


border-radius: <length> <length>


The two lengths are, for left-to-right and right-to-left scripts, respectively horizontal radius, and vertical radius.

For top-to-bottom scripts, and bottom-to-top scripts, the values are respectively vertical radius, then horizontal radius.

If the second length is omitted, it should be interpreted as being equal to the first property, thus making the corner a quarter circle.

If the second length is set to zero, the resulting corner will be square.

Individual corners

The border-radius may be specified individually for each corner, through the use of:

* border-top-right-radius
* border-bottom-right-radius
* border-bottom-left-radius
* border-top-left-radius

Browser compatibility

At the time of writing, the border-radius properties are not supported in any browser, since the CSS3 border module is still in “Working Draft” status.

However, browsers based on the Gecko rendering engine (Firefox, Mozilla) has experimental support for the border-radius property, and use the vendor-specific -moz- prefix for the properties, making it -moz-border-radius
Practical use of border-radius

If you absolutely want to make use of the border-radius properties now, and want to maintain forward compatibility, Yous should use both the Gecko specific property, and the CSS3 property. Further, you must restrict yourself to only creating perfectly circular corners, using only one length value:


blockquote {
-moz-border-radius: 2em;
border-radius: 2em;
}



This is because the Mozilla implementation of border-radius is severely out of line with the CSS3 working draft. Mozilla accepts up to four length values for the border-radius property, and interprets them as -moz-border-top-left-radius, -moz-border-top-right-radius, -moz-border-bottom-right-radius and -moz-border-bottom-left-radius with one value for each.

border-radius example given below:

One length value

If the second length value is omitted, it is interpreted as being equal to the first, meaning that border-radius: 5px 5px is equal to border-radius: 5px;. Example:


#example1 {
-moz-border-radius: 1em;
border-radius: 1em;
}



Different length values

When the length values are different, the first length value will be interpreted as horizontal length, and the second one as vertical length, for left to right scripts. Example:


#example2 {
-moz-border-radius: 2em 1em;
border-radius: 2em 1em;
}

HTML and CSS hacks for IE


I’m going to share the better way of box model hack if you want to use style definitions specifically for specific MSIE (Microsoft Internet Explorer) versions. A way that may make the IE Factor smaller.

Conditional Comments

MSIE for Windows has for a long time had a feature named Conditional Comments that allows content to be visible only for MSIE. Use of conditional comments instead of other css hacks is simple:

» Create a stylesheet common for all browser, without using any hacks to work around rendering problems in MSIE.
» Create a stylesheet common for all versions of MSIE
» Create a separate stylesheet for each of the MSIE versions you want to target.
» Include the stylesheets from 2 and 3 by using a conditional comment

Conditional comment syntax

The conditional comment is just a specially formatted HTML comment that is picked up only by various flavors of Internet Explorer for Windows.

The following conditional comment is being picked up by IE5, IE5.5 and IE6:


<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie.css" />
<![endif]-->


If you don’t want your IE-specific styles to be overridden by your regular stylesheet, source order is significant; you’d want to specify the common stylesheet first, with the IE-specific versions following:


<link rel="stylesheet" type="text/css" href="common.css" />

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie.css" />
<![endif]-->

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie-6.0.css" />
<![endif]-->

<!--[if lt IE 6]>
<link rel="stylesheet" type="text/css" href="ie-5.0+5.5.css" />
<![endif]-->


Conditional comment in CSS


{/* any IE */float: expression('none');/* IE 5.x */}
{/* any Moz */float: expression('none');/* Moz 2.x */}

Sunday, February 15, 2009

HTML TUTORIAL: How to show two events on a single click by using Onclick event


In this post I would like to share some tips to show two or more events on a single click. There are many ways you will find through Google search but the most easiest way I would like to share with you. Its very simple. Let's take a example, suppose you want to show some html document with some pdf file in a pop-up on a single click... here is a code for that:

<input type="submit" name="print" onClick="popup = window.open('example.pdf', 'PopupPage', 'height=768,width=960,scrollbars=yes,resizable=yes'); location.href='example.html'" target="_blank" value="Print" class="btn_bg"/>

Hope you would like it. Drop your comment on the same :D

Thursday, February 12, 2009

How to use bookmark script in your html page


In this post you will learn how to use bookmark script in your html page. It is very easy to use bookmark script here are the simple steps to follow:

Step 1: Add the code given below in the <head> section of your website.

<script type=”text/javascript”>
function bookmarksite(title,url){

if (window.sidebar) // firefox

window.sidebar.addPanel(title, url, “”);

else if(window.opera && window.print){ // opera


var elem = document.createElement(’a');

elem.setAttribute(’href’,url);

elem.setAttribute(’title’,title);

elem.setAttribute(’rel’,’sidebar’);


elem.click();

}

else if(document.all)// ie

window.external.AddFavorite(url, title);

}

</script>


Step 2: Create an image or text link and for the href attribute use this code

javascript:bookmarksite(’title_of_site’, ‘url_of_site’)



Its done now!

Monday, February 9, 2009

Difference between CSS2 and CSS3


Many exciting new functions and features are being lined up for CSS3. I have showcase some of them on this post.

Here they are:

Borders

* border-color
* border-image
* border-radius
* box-shadow

Backgrounds

* background-origin and background-clip
* background-size
* multiple backgrounds

Color

* HSL colors
* HSLA colors
* opacity
* RGBA colors

Text effects

* text-shadow
* text-overflow
* word-wrap

User-interface

* box-sizing
* resize
* outline
* nav-top, nav-right, nav-bottom, nav-left

Selectors

* attribute selectors

Basic box model

* overflow-x, overflow-y

Generated Content

* content

Other modules

* media queries
* multi-column layout
* Web fonts
* speech

Free URL submission sites


Submitting your URL will help get your site crawled, however you must still build relevant links to get traffic to your site. The best way to do this is through good content! Here are some good url submission sites:

SplatSearch URL Submit
Add your webpage to this search engine.

Scrub the Web
What a great site! Find out how your meta tags, keywords, title tag and other features are working (or not working) for your site, for FREE!

Exalead URL Submit
Exalead FREE URL Submission.

Jayde URL Submit
Free URL Submission through this site.

ExactSeek.com URL Submit
Create an account for FREE URL Submission.

WebSquash URL Submit
Enter a web address to start the crawler.

Suggest a Site to Open Directory
Have something worth submitting? The Open Directory Project is a web directory of Internet resources. A web directory is something akin to a huge
reference library.

InfoTiger Website Submit
Try it out! Just submit your URL along with your email and you're good to go.

Url Submitter
Submit Your Website To 66 Of The Top Search Engines Every Month For Free!

Thursday, February 5, 2009

Rumba Easy: A Free PHP based Content Managent System


First and foremost, Rumba is a Content Management System (CMS). It is the engine behind your website that simplifies the creation, management, and sharing of content. Use Rumba as CMS, blog, site of news or personal page. The Rumba Netware Team focuses on building a solid application framework rather than on add-ons that are typically found in many portal solutions. This keeps the Rumba core extremely lightweight and efficient, thus making it easier for anybody to extend Rumba through custom third party component and modules that directly serve their needs. Rumba is supplied as an archive.
Its a free to use and download.

Features:

* The contents of the site is stored in a single HTML-file
* To database can be added exterior files
* The triple level of pages
* Internet shop (The interactive price-list)
* Automatic exchange of hyperlinks between internal pages
* Multitemplates
* Friendly URLs
* Commentary
* Captcha
* Mailing of comments Dispatch of comments Email To Discussion
* Spam Protection
* Dynamic menu
* Search Engine
* Sitemap
* Search history
* Unique TITLE for pages
* Administerring by means of html-editors
* Integrated Google Adsense
* Flexible adjustment
* Simple ( or simplest ) interface
* Minimal size

Click here to download

Free MS SQL PHP Generator


MS SQL PHP Generator is a freeware but powerful Microsoft SQL GUI frontend that allows you to generate high-quality SQL Server PHP scripts for the selected tables, views and queries for the further working with these objects through the web.

Key features include


  • Data management abilities (adding, editing and deleting records)

  • Customization of the HTML appearance

  • Filtering and sorting abilities

  • Data protection with a lot of security settings

  • Lookup options for master-detail relations

  • Integrated script navigation and ability to create multilingual web apps



Click here to download

Wednesday, February 4, 2009

Create search engine optimized pages within seconds/minutes


This amazing script creates realistic, highly effective, search engine optimized pages within seconds/minutes. Automatic Doorway Blaster can drive massive amounts of traffic to your website!

This amazing script creates realistic, highly effective, search engine optimized pages within seconds/minutes. Automatic Doorway Blaster can drive massive amounts of traffic to your website!

Configuar the script according to your need. Password protected Admin Area. Automatically redirect your visitor after a certain period or never redirect. The Mega Tag of your page is Optimized for Search Engines. Creates upto 10000 individual pages with just a single click of your mouse. Creates Individual pages for every Keyword. Enter Keywords manually or Collect keywords from a webpage automatically. Configuar your doorway page yourself according to your need. Support is available from within the script.

Click here to download

Convert your digital pics into pencil sketch


FotoSketcher turns digital photos into beautiful pencil sketches or paintings in seconds. This free program can help you create images that really look like they have been hand drawn by the best artists. If you want to turn a portrait, the photograph of your house or even the picture of your pet into a black & white or colour pencil sketch, then look no further, FotoSketcher will do this in just a few seconds.

Now you can print stunning images to make original gifts for your friends or relatives, or print on birthday cards or even T-shirts.

And best of all, it comes with absolutely no strings attached!

Click here to download FotoSketcher

Get an article submission site for free and make money with Google Adsense


You can now run an article submission site that gets other people to submit articles, There's no doubt that Google Adsense is a proven money maker, but getting content pages to put those ads on is probably the most difficult thing for any internet to do. A fully functional administrative backend to keep track of all your users and articles! Easy-to-use functions that let you e-mail all your users. Absolutely everything you need to run your own turnkey article web site. Its free to download.

Click here to download

Advanced RSS Publisher: Automatically publish aggregated news pages or articles on your website


Advanced RSS Publisher helps you to download newsfeeds in RSS and XML format, reformat them according to user-defined HTML templates, upload results to website via shared folder or ftp, work with free newsfeeds and articles available for download and redistribution.

Advanced RSS Publisher can support as many website as you like. Each website update is set as a separate task in the program.

Advanced RSS Publisher is a Windows based program which runs in your system tray. It has a built-in schedule for each task and program automatically updates your website based on this schedule. Its free to download.

Click here to download

 

Copyright © 2009 - tutorialfeed.org