int width = 0;
int height = 0;
//
var webClient = new System.Net.WebClient();
byte[] image = webClient.DownloadData("http://static.livedemo00.template-help.com/wt_38438/images/page4_img2b.jpg");
//
//byte[] image = FileUpload1.FileBytes;
Int32.TryParse("100", out width);
Int32.TryParse("100", out height);
ImageHandler imageHandler = new ImageHandler();
bool maintainAR = true;
//calling CreateThumbnail Method to create thumb images
//it returns Bitmap Image.
Bitmap bmp = imageHandler.CreateThumbnail(image, maintainAR, width, height);
if (bmp != null)
{
//creating a file name with guid.
string fileName = Guid.NewGuid().ToString() + ".jpg";
//saving in current root folder.
bmp.Save(Server.MapPath(fileName));
//set image controls ImageUrl to saved Image, this is to view the thumbnail image
Image1.ImageUrl = fileName;
}
else
{
//exception part
if (imageHandler.havException)
{
Response.Write(imageHandler.ExceptionMessage);
}
}
Wednesday, March 28, 2012
Make image proportionately small from url link asp.net
Tuesday, March 27, 2012
Image upload through FCK editor - Solution
Steps to make it working.
1. Add
in web.config file.
this path represents the path you want are uploading the image
2. change
var _FileBrowserLanguage = 'aspx'; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'aspx'; // asp | aspx | cfm | lasso | perl | php | py
in fckconfig.js file. for .net only.
3. put the absolute path like
UserFilesAbsolutePath = "C:\\Users\\soumen\\Desktop\\web\\fckeditor\\editor\\images\\UserFilesUpload";
in connector.aspx under "\fckeditor\editor\filemanager\connectors\aspx"
1. Add
in web.config file.
this path represents the path you want are uploading the image
2. change
var _FileBrowserLanguage = 'aspx'; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'aspx'; // asp | aspx | cfm | lasso | perl | php | py
in fckconfig.js file. for .net only.
3. put the absolute path like
UserFilesAbsolutePath = "C:\\Users\\soumen\\Desktop\\web\\fckeditor\\editor\\images\\UserFilesUpload";
in connector.aspx under "\fckeditor\editor\filemanager\connectors\aspx"
Monday, March 19, 2012
Encode decode in PHP
class Encryption {
var $skey = "kuntal"; // you can change it
public function safe_b64encode($string) {
$data = base64_encode($string);
$data = str_replace(array('+','/','='),array('-','_',''),$data);
return $data;
}
public function safe_b64decode($string) {
$data = str_replace(array('-','_'),array('+','/'),$string);
$mod4 = strlen($data) % 4;
if ($mod4) {
$data .= substr('====', $mod4);
}
return base64_decode($data);
}
public function encode($value){
if(!$value){return false;}
$text = $value;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->skey, $text, MCRYPT_MODE_ECB, $iv);
return trim($this->safe_b64encode($crypttext));
}
public function decode($value){
if(!$value){return false;}
$crypttext = $this->safe_b64decode($value);
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->skey, $crypttext, MCRYPT_MODE_ECB, $iv);
return trim($decrypttext);
}
}
?>
Subscribe to:
Posts (Atom)