Crop Image Like Orkut

June 5th, 2008 by Sajith M.R
This entry is part 4 of 5 in the series Online Photoshop

Online Photoshop in PHP (Series Part 4) >>

Crop Image Like Orkut

Today we will discuss about cropping of images using php and gd library.

Look at the simple example here:

http://www.sajithmr.com/photoshop-tuts/crop/simplecrop.php


Here the Crop function is doing the real work. x1 and y1 are Top-Left Coordinates of new image and x2, y2 are the Bottom-Right .

Here is the function for Crop

loadImageFromObject($image);
		$cc->cropToDimensions($xpos1, $ypos1, $xpos2,$ypos2 );
		return $cc->getImageObject();

	}

?>

You can see the class.cropcanvas.php file from the attachment.

In the above example, we have to enter each coordinates manually. See the example below:

http://www.sajithmr.com/photoshop-tuts/crop/realcrop.php

Here you can select the area by click and drag (like orkut)

This is implemented with the help or jslib javascript. The given attachment in the end of this post contains the all.

http://www.sajithmr.com/photoshop-tuts/crop.zip

Keep reading for the further posts in this series. Next post is on Intellegent watermarking on images.

Subscribe to my Feeds: http://www.sajithmr.com/feed/

Orkut/Facebook/Flickr/Hi5 is banned in my Office :( Need a Solution ? Yes Answer is Here !!!

December 11th, 2007 by Sajith M.R

If your organization / office blocked your favorite website, dont worry, we have a solution.

If you have your own website / server and ssh access to it, you can browse any website through that. All what you need is putty.exe (in windows).

See below the steps for that:

You need putty for this purpose. Download putty.exe from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

(Read my previous post on putty here )

1) Open putty.exe

2) Enter your server’s ip address and ssh port. (Default is 22 )

3) In the Category tree (left), expand Connection , expans SSH and select Tunnels

4) Enter any source port (eg: 8888 or 7777 - avoid port less than 1000)

5) Select the dynamic radio button

6) Press Ok and login into your server via ssh.

Now your ssh with tunnel is ready.

Goto your browser .

If you are using moziila, take tools (from menu) > Options.

Advanced > Network options > Settings.

Select Manual Proxy settings.

Leave all the places blank . Enter Socks Host as 127.0.0.1 and port as we set earlier in putty’s tunnel settings (say 8888)

Press OK and browse. You are now browsing via your own server. Thus you bypassed your local system or LAN network. Thus you can access any websites which are blocked from your organization.

If you are using IE, follow the same instructions for proxy settings.

Now enjoy browsing with your favorite sites. cool na !!!

For any queris, mail me : admin@sajithmr.com