You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.8 KiB
80 lines
1.8 KiB
8 years ago
|
<?php
|
||
|
|
||
|
function conv_data($od,$lang){
|
||
|
$tmp=explode("-",substr($od,0,10));
|
||
|
switch($lang){
|
||
|
case "IT":
|
||
|
case "FR":
|
||
|
case "ES":
|
||
|
$stres = $tmp[2]."/".$tmp[1]."/".$tmp[0]."";
|
||
|
break;
|
||
|
case "DE":
|
||
|
$stres = $tmp[2].".".$tmp[1].".".$tmp[0]."";
|
||
|
break;
|
||
|
default:
|
||
|
$stres=$od;
|
||
|
}
|
||
|
return $stres;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
function convert($stringa){
|
||
|
$strres = $stringa;
|
||
|
$strres = str_replace("'","'",$strres);
|
||
|
return stripslashes(nl2br($strres));
|
||
|
}
|
||
|
|
||
|
|
||
|
function convert_mce($stringa){
|
||
|
$strres = $stringa;
|
||
|
$strres = str_replace("'","'",$strres);
|
||
|
return stripslashes($strres);
|
||
|
}
|
||
|
|
||
|
function conv_url($text){
|
||
|
$entities = array('+','%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
|
||
|
$replacements = array('-','_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_',);
|
||
|
return str_replace($entities, $replacements, urlencode($text));
|
||
|
}
|
||
|
|
||
|
|
||
|
function save_photo($foto,$basepath,$id){
|
||
|
|
||
|
$filename = $foto;
|
||
|
// Get new sizes
|
||
|
list($width, $height) = getimagesize($filename);
|
||
|
$percent=800/$width;
|
||
|
$newwidth = $width * $percent;
|
||
|
$newheight = $height * $percent;
|
||
|
|
||
|
// Load
|
||
|
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||
|
|
||
|
switch(exif_imagetype($filename)){
|
||
|
case 1:
|
||
|
$source = imagecreatefromgif($filename);
|
||
|
break;
|
||
|
|
||
|
case 2:
|
||
|
$source = imagecreatefromjpeg($filename);
|
||
|
break;
|
||
|
|
||
|
case 3:
|
||
|
$source = imagecreatefrompng($filename);
|
||
|
break;
|
||
|
|
||
|
}
|
||
|
// Resize
|
||
|
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||
|
|
||
|
// Output
|
||
|
imagejpeg($thumb, $basepath."$id.jpg");
|
||
|
// echo $basepath."$id.jpg";
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
?>
|