$newWidth) { $ratio_type='width'; } else { $ratio_type='height'; } } if($ratio_type=='width') { // If the dimensions for thumbnails are greater than original image do not enlarge if($newWidth > $curWidth) { $newWidth = $curWidth; } $newHeight = $newWidth / $ratio; } else if($ratio_type=='height') { // If the dimensions for thumbnails are greater than original image do not enlarge if($newHeight > $curHeight) { $newHeight = $curHeight; } $newWidth = $newHeight * $ratio; } else if($ratio_type=='crop') { if($ratio < $thumbRatio) { $srcHeight = round($curHeight*$ratio/$thumbRatio); $srcY = round(($curHeight-$srcHeight)/2); } else { $srcWidth = round($curWidth*$thumbRatio/$ratio); $srcX = round(($curWidth-$srcWidth)/2); } } else if($ratio_type=='distort') { } // create image switch ($fileType) { case 1: if (function_exists("imagecreatefromgif")) { $originalImage = imagecreatefromgif($imgPath); } else { if ($verbose) { echo "GIF images are not support in this php installation."; return false; } } $fileExt = 'gif'; break; case 2: $originalImage = imagecreatefromjpeg($imgPath); $fileExt = 'jpg'; break; case 3: $originalImage = imagecreatefrompng($imgPath); $fileExt = 'png'; break; default: if ($verbose) { echo "Not a valid image type."; } return false; } // create new image $resizedImage = imagecreatetruecolor($newWidth, $newHeight); //echo "$srcX, $srcY, $newWidth, $newHeight, $curWidth, $curHeight"; //echo "
$srcX, $srcY, $newWidth, $newHeight, $srcWidth, $srcHeight
"; imagecopyresampled($resizedImage, $originalImage, 0, 0, $srcX, $srcY, $newWidth, $newHeight, $srcWidth, $srcHeight); imageinterlace($resizedImage, 1); switch ($fileExt) { case 'gif': imagegif($resizedImage, $destPath, $quality); break; case 'jpg': imagejpeg($resizedImage, $destPath, $quality); break; case 'png': imagepng($resizedImage, $destPath, $quality); break; } // return true if successfull return true; } function createThumbs($pathToImages,$fname,$thumbHeight='',$thumbWidth='',$ratio_type = 'width') { $pathToThumbs="thumb_cache/thumb_".$thumbHeight."_".$thumbWidth."_".$fname; //echo "aaaaaaaaaaa".$pathToImages.$fname; exit; $info = pathinfo($pathToImages . $fname); $file_extenssion=strtolower($info['extension']); //echo $pathToImages; exit; $pathToImages=$pathToImages; if(file_exists($pathToImages.$fname)) { $pathToImages_file= $pathToImages.$fname; $pathToThumbs2=SITE_DOC_ROOT.$pathToThumbs; //echo $pathToThumbs2; exit; if(!file_exists($pathToThumbs2)) { make_thumb_gd($pathToImages_file, $pathToThumbs2, $thumbWidth, $thumbHeight, $ratio_type, $quality = 70, $verbose = false) ; $return_path=SITE_URL.'/programs/'.$pathToThumbs; } else { $return_path=SITE_URL.'/programs/'.$pathToThumbs; } } return $return_path; } function qry_str($arr, $skip = '') { $s = "?"; $i = 0; foreach($arr as $key => $value) { if ($key != $skip) { if (is_array($value)) { foreach($value as $value2) { if ($i == 0) { $s .= $key . '[]=' . $value2; $i = 1; } else { $s .= '&' . $key . '[]=' . $value2; } } } else { if ($i == 0) { $s .= "$key=$value"; $i = 1; } else { $s .= "&$key=$value"; } } } } return $s; } function db_sclar($sql_db) { $rs_db=mysql_query($sql_db); $data_db=mysql_fetch_array($rs_db); return $data_db[0]; } function db_query($sql) { $rs=mysql_query($sql) or die(mysql_error()); return $rs; } function fun_send_sms_user_new($user,$sno,$rno,$msg) { $mno="91".$rno; $sql=" SELECT ad_msg FROM tbl_ads WHERE ad_status='1' ORDER BY id DESC LIMIT 1"; $res=mysql_query($sql); $rec=mysql_fetch_array($res); $ad_msg=$rec['ad_msg']; //."%0A" for next line but not supporting now $final_msg='From : '.$sno."\n".$msg ."\n"." {".$ad_msg."}"; if($sno!=""){ func_savesms($rno,$sno,$final_msg); } $params="user=".$user."&senderID=tmindia&receipientno=".$rno."&msgtxt=".$final_msg."&state=4&dcs=0"; $ch = curl_init() or die(curl_error()); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); curl_setopt($ch, CURLOPT_URL,"http://api.mvaayoo.com/mvaayooapi/MessageCompose?"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $buffer=curl_exec($ch) or die(curl_error()); //print_r($params); if (empty($buffer)) { $error=1; } else {$error=0; } curl_close($ch); return $error; } function fun_send_sms_admin_new($rno,$sno,$msg) { $user=MVAYOO_API; $mno="91".$rno; $sql=" SELECT ad_msg FROM ".TABLE_ADS." WHERE ad_status='1' ORDER BY id DESC LIMIT 1"; $res=mysql_query($sql); $rec=mysql_fetch_array($res); $ad_msg=$rec['ad_msg']; $final_msg='From : SMSTAU'."\n".$msg ."\n"." {".$ad_msg."}"; if($sno!=""){ func_savesms($rno,$sno,$final_msg); } $params = array( /* user param is your username:password */ 'user' =>MVAYOO_API, 'receipientno' => $mno, 'senderID' => 'tmindia', 'dcs' =>0, 'state' => 4, 'msgtxt' =>$final_msg); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://api.mVaayoo.com/mvaayooapi/MessageCompose?' . http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $buffer = curl_exec($ch); if (empty($buffer)) { $error=1; } else {$error=0; } curl_close($ch); return $error; } ?>--".$sdata2[2].""; } return $string2; } function create_droop_down($name='',$sql,$where,$selected_value,$styles) { $where2=$where; $sql_cat=$sql. $where2; //echo $sql_cat; $string=""; return $string; } function create_country_droop_down($name='',$selected_value,$styles) { $sql_cat="select * from tbl_countries where 1"; $string=""; $rs=mysql_query($sql_cat); while($sdata=mysql_fetch_row($rs)) { $string.="