Is there any ruby way to show thumbnail preview of image before upload? Using below javascript, I can achieve this window.URL = window.URL || window.webkitURL; var fileElem = document.getElementById("fileElem"); function handleFiles(files) { var img = document.getElementById("image-preview"); if (!files.length) { img.src = "/img/default-profile-image.png"; } else { img.src = window.URL.createObjectURL(files[0]); img.height = 60; img.onload = function(e) { window.URL.revokeObjectURL(this.src); } } } but I want to keep the thumbnail image in the case of validation fails. Please help me.... Thanks in advance, Avantec -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
2012/9/25 Avantec Van <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Is there any ruby way to show thumbnail preview of image before upload?No! There can''t be! Ruby needs you to have that image on the server to generate a thumb of it, but before the upload it is not on the server. What you try here, is not possible in PHP, whatever.NET or any other kind of server-side-scripting-language. But wait… Once, I stumbled upon a project, that is a ruby-interpreter implemented in JavaScript, but can''t remember its name. With that it would be possible to generate the preview, but not to save it anywhere… -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.