/ Published in: PHP
AL subir imagen png, se deben pasar al directorio con transparencia
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$myfile=$_FILES["youimage"]; function ismyimage($myfile) { if((($myfile["type"] == "image/gif") || ($myfile["type"] == "image/jpg") || ($myfile["type"] == "image/jpeg") || ($myfile["type"] == "image/png")) && ($myfile["size"] <= 2097152 /*2mb*/) ) return true; else return false; } function upload_file($myfile) { if(ismyimage($myfile)){ $mywidth=$information[0]; $myheight=$information[1]; $newwidth=$mywidth; $newheight=$myheight; while(($newwidth > 600) || ($newheight > 400 )){ } $files=$myfile["name"]; if($myfile["type"] == "image/gif"){ if($con){return true;} else {return false;} } else if(($myfile["type"] == "image/jpg") || ($myfile["type"] == "image/jpeg") ) { if($con){ return true;} else {return false;} } else if($myfile["type"] == "image/png") { if($con){ return true;} else {return false;} } } else return false; }