Wasim Abbas
Google AdSense link with Blogger
Friday 25 March 2016
Friday 4 March 2016
Wednesday 29 February 2012
Sunday 19 February 2012
Nusrat Fateh Ali Khan: "ALI MAULA, ALI MAULA, ALI DAM DAM"
Lakh Te Caroran Wari Akho Dammmmmm DAMMMMM HAQ''
Friday 3 February 2012
Wednesday 1 February 2012
Favorite videos (playlist)
Jashan -E- Milad -E- Mustapha S.W.A Marhaba
('http://www.youtube.com/p/6GefaLTcIA6F8Pf7U0EJTQ?version=3&hl=en_US',)
('http://www.youtube.com/p/6GefaLTcIA6F8Pf7U0EJTQ?version=3&hl=en_US',)
Monday 12 December 2011
Image Upload In PHP
![]() |
SilverLight |
$max_height = 100;
function getPictureType($files)
{
$split = explode('.', $files);
$ext = $split[count($split) - 1];
if ( preg_match('/jpg|jpeg/i', $ext) ) {
return 'jpg';
} else if ( preg_match('/png/i', $ext) ) {
return 'png';
} else if ( preg_match('/gif/i', $ext) ) {
return 'gif';
} else {
return '';
}
}
function makeThumb($files, $type, $path)
{
global $max_width, $max_height;
$chkThumbFolder = opendir($path);
while(false!==($file = readdir($chkThumbFolder)))
{
if(!is_dir($path.'thumbs')){
mkdir($path.'thumbs');
chmod($path.'thumbs',0777);
}
if (!file_exists($path.'thumbs/'.$files)){
if($type == 'jpg'){
$src = imagecreatefromjpeg($path.$files);
}else if($type == 'png'){
$src = imagecreatefrompng($path.$files);
}else if($type == 'gif'){
$src = imagecreatefromgif($path.$files);
}
if(($oldW = imagesx($src)) < ($oldH = imagesy($src))){
$newW = $max_width;
$newH = $max_height;
}else{
$newW = $max_height;
$newH = $max_width;
}
$new = imagecreatetruecolor($newW, $newH);
imagecopyresampled($new, $src, 0, 0, 0, 0, $newW, $newH, $oldW, $oldH);
if ( $type == 'jpg' ) {
imagejpeg($new, $path."thumbs/".$files);
} else if ( $type == 'png' ) {
imagepng($new, $path."thumbs/".$files);
} else if ( $type == 'gif' ) {
imagegif($new, $path."thumbs/".$files);
}
imagedestroy($new);
imagedestroy($src);
}
}
}
$image = $_FILES['image']['name'];
$image1 = $_FILES['image']['tmp_name'];
$path = "images/";
move_uploaded_file($image1,$path.$image);
makeThumb($image, getPictureType($image), $path);
Labels:
Upload Function
Location:
Mazang, Lahore, Pakistan
Subscribe to:
Posts (Atom)