Thursday, 28 May 2009

Merging String with the image in php


header("Content-type: image/jpeg");
$string = "jothirajafgjhvdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsgdsdsg
sdgdsgdsgdsgdsg";
$im = imagecreatefromjpeg("butterfly.jpg");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 40.5 * strlen($string)) / 100;
imagestring($im, 3, $px, 380, $string, $orange);
imagejpeg($im);
$jothirajan_a= "IMAGE_".date('d').time().".jpg";
imagejpeg ($im,"image/".$jothirajan_a."");
imagedestroy($im);
?>

Merging images in php

$imgStop = imagecreatefromjpeg("AAKX001003.jpg"); /* Attempt to open */


$imgThumb = imagecreatefromjpeg("AXR001600.jpg");


imagecopy($imgThumb,$imgStop,0,450,0,0,480,50);


header("Content-type: image/jpeg");
imagejpeg($imgThumb);


$jothirajan_a= "IMAGE_".date('d').time().".jpg";
imagejpeg ($imgThumb,"image/".$jothirajan_a."");
imagedestroy($imgThumb);

?>

Image to image merging in php

>>> Create folder called image/

This is my code
$imgStop = imagecreatefromjpeg("AAKX001003.jpg"); /* Attempt to open */

$imgThumb = imagecreatefromjpeg("AXR001600.jpg");

imagecopy($imgThumb,$imgStop,0,450,0,0,480,50);

header("Content-type: image/jpeg");

imagejpeg($imgThumb);

$jothirajan_a= "IMAGE_".date('d').time().".jpg";

imagejpeg ($imgThumb,"image/".$jothirajan_a."");

imagedestroy($imgThumb);

?>

Thursday, 16 April 2009

Encrpt and Decrypt the Password in PHP


FUNCTION
ENCRYPT_DECRYPT1($Str_Message) {

$Len_Str_Message=STRLEN($Str_Message);
$Str_Encrypted_Message="";
echo
$Str_Encrypted_Message."
"
;
FOR (
$Position = 0;$Position<$Len_Str_Message;$Position++){

$Key_To_Use = (($Len_Str_Message+$Position)+1);
$Key_To_Use = (255+$Key_To_Use) % 255;
$Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
$Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
$Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;
$Encrypted_Byte = CHR($Xored_Byte);
$Str_Encrypted_Message .= $Encrypted_Byte;


}
RETURN
$Str_Encrypted_Message;
}

Wednesday, 15 April 2009

Close the POPUP and REDIRECT to Parent

" close the popup window and redirect to the parent window

Dreamweaver users click here "

Simple image popup


onClick="window.open('listing_image/{$eat[test].listing_image}','', 'width=,height=,scrollbars=0');
return false;">Click to Enlarge<

Image validation

function checkPhoto(imagePath) {
var pathLength = imagePath.length;
var lastDot = imagePath.lastIndexOf(".");
var fileType = imagePath.substring(lastDot,pathLength);

if((fileType == ".gif") || (fileType == ".jpg") || (fileType == ".png") || (fileType == ".GIF") || (fileType == ".JPG") || (fileType == ".PNG")) {
return true;
} else {
alert("We supports .JPG, .PNG, and .GIF image formats. Your file-type is " + fileType + ". If you are having difficulties with this step, please send an e-mail to trevor@trevor.net.");
}
}