Foros del Web » Programando para Internet » Jquery »

Preview de imagenes verticales aparecen horizontales

Estas en el tema de Preview de imagenes verticales aparecen horizontales en el foro de Jquery en Foros del Web. tengo este script jquery @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código Javascript : Ver original < script type = "text/javascript" language = "javascript" >     $ ( window ...
  #1 (permalink)  
Antiguo 03/05/2014, 03:47
 
Fecha de Ingreso: mayo-2011
Ubicación: Entre Navarra y Aragón
Mensajes: 96
Antigüedad: 12 años, 11 meses
Puntos: 0
Preview de imagenes verticales aparecen horizontales

tengo este script jquery

Código Javascript:
Ver original
  1. <script type="text/javascript" language="javascript">
  2.     $(window).load(function(){
  3.        
  4.         $(function() {
  5.            
  6.             $('#file-input').change(function(e) {
  7.                 addImage(e);
  8.             });
  9.  
  10.             function addImage(e){
  11.                 var file = e.target.files[0],
  12.                 imageType = /image.*/;
  13.        
  14.                 if (!file.type.match(imageType))
  15.                 return;
  16.      
  17.                 var reader = new FileReader();
  18.                 reader.onload = fileOnload;
  19.                 reader.readAsDataURL(file);
  20.             }
  21.      
  22.             function fileOnload(e) {
  23.                 var result=e.target.result;
  24.                 $('#imgSalida').attr("src",result);
  25.             }
  26.         });
  27.     });
  28.     </script>

ésto me permite mostrar una preview de una foto para saber que foto subir más fácilmente, vamos lo que hace Facebook cuando seleccionas una foto. Las fotos horizontales aparecen genial, pero las fotos verticales las gira y las vuelve horizontales, tanto en la preview como cuando las sube...

como lo puedo solucionar?
  #2 (permalink)  
Antiguo 05/05/2014, 05:21
 
Fecha de Ingreso: mayo-2011
Ubicación: Entre Navarra y Aragón
Mensajes: 96
Antigüedad: 12 años, 11 meses
Puntos: 0
Respuesta: Preview de imagenes verticales aparecen horizontales

alguien sabe?
  #3 (permalink)  
Antiguo 19/05/2014, 07:51
 
Fecha de Ingreso: mayo-2011
Ubicación: Entre Navarra y Aragón
Mensajes: 96
Antigüedad: 12 años, 11 meses
Puntos: 0
Respuesta: Preview de imagenes verticales aparecen horizontales

Sigo probando con más códigos y en todos me pasa igual... os dejo uno de los últimos que he probado

Código Javascript:
Ver original
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset=utf-8 />
  5. <title>Image preview</title>
  6. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  7. <script>
  8. var blank="http://upload.wikimedia.org/wikipedia/commons/c/c0/Blank.gif";
  9. function readURL(input) {
  10.     if (input.files && input.files[0]) {
  11.         var reader = new FileReader();
  12.  
  13.         reader.onload = function (e) {
  14.             $('#img_prev')
  15.             .attr('src', e.target.result)
  16.             .height(200);
  17.         };
  18.  
  19.         reader.readAsDataURL(input.files[0]);
  20.     }
  21.     else {
  22.       var img = input.value;
  23.         $('#img_prev').attr('src',img).height(200);
  24.     }
  25.     $("#x").show().css("margin-right","10px");
  26. }
  27. $(document).ready(function() {
  28.   $("#x").click(function() {
  29.     $("#img_prev").attr("src",blank);
  30.     $("#x").hide();  
  31.   });
  32. });
  33. </script>
  34. <!--[if IE]>
  35. <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  36. <![endif]-->
  37. <style>
  38. article, aside, figure, footer, header, hgroup,
  39. menu, nav, section { display: block; }
  40. #x { display:none; position:relative; z-index:200; float:right}
  41. #previewPane { display: inline-block; }
  42. </style>
  43. </head>
  44. <body>
  45. <section>
  46. <input type='file' onchange="readURL(this);" /><br/>
  47. <span id="previewPane">
  48. <img id="img_prev" src="#" alt="your image" />
  49. <span id="x">[X]</span>
  50. </span>
  51. </section>
  52. </body>
  53. </html>

Etiquetas: imagenes, preview
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:31.