Código PHP:
   
<?php
function create_tb($img_o,$w_tb,$h_tb,$bg_color){
 $img_return=imagecreatetruecolor($w_tb,$h_tb);
 if(isset($bg_color) && $bg_color != ""){
   $color= imagecolorallocate($img_return, hexdec(substr($bg_color,0,2)), hexdec(substr($bg_color,2,2)), hexdec(substr($bg_color,4,2))); 
 }else{
  $color= imagecolorallocate($img_return, 255, 255, 255);
 }
 
    imagefilledrectangle($img_return, 0, 0, $w_tb, $h_tb, $color);
 $wo=imagesx($img_o);
 $ho=imagesy($img_o);
 
 if($wo >= $ho){ 
  
  $wtb_copy=$w_tb;
  $htb_copy=($ho*(($w_tb*100)/$wo))/100;
  $xtb_copy=0;
  $ytb_copy=($h_tb/2)-($htb_copy/2);
 }elseif($ho > $wo){
  
  $wtb_copy=($wo*(($h_tb*100)/$ho))/100;
  $htb_copy=$h_tb; 
  $xtb_copy=($w_tb/2)-($wtb_copy/2);
  $ytb_copy=0;
 }
 imagecopyresampled($img_return, $img_o, $xtb_copy, $ytb_copy, 0, 0, $wtb_copy, $htb_copy, $wo, $ho);
 return $img_return;
}
 
 
 
 
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$valido = true; 
$file=$_FILES["file"];
    if($file["type"]=="image/pjpeg" || $file["type"]=="image/jpg" || $file["type"]=="image/jpeg"){ 
        if($file["size"]>=5120000){
              $valido = false;
            $msgimg="Error! La imagen es muy grande!";
         }
    }else{
        $valido = false;
        $msgimg="Error!  la imagen debe ser .jpg";
    }
 
 
    
    if($valido){
     $imgGrande=imagecreatefromjpeg($file["tmp_name"]);
     $imggrande=create_tb($imgGrande,150,150,"FFFFFF");
    imagejpeg($imggrande,"gfx/imagen_".$id.".jpg",60);
            
 
    }
}
?>    Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 204 extraneous bytes before marker 0xd9 in C:\wamp\www\misitio\foto.php on line 52
Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'C:\wamp\tmp\php16B.tmp' is not a valid JPEG file in C:\wamp\www\misitio\foto.php on line 52
que puede ser esto?
 
 

 Problema con .JPG
 Problema con .JPG 
 
 
