I’ve got a file upload that uploads an image to a server. That image is
then manipulated via rmagick.
I’ve only just found that for files less than 10KB in size, that the
object is not a Tempfile, but a StringIO. If it’s a Tempfile (e.g.
image file is over 10KB) the site works fine, but for small images, it
fails!
Thing is, that I can’t figure out how to get a StringIO into RMagick to
create an imagemagick image, so that I can manipulate it.
What this mess does is hide my ‘image’ field. ‘image’ is always
SQL-safe Base64 encoded, while image_binary is the undecoded version.
I won’t let people store more than the correct size in my database, so
I adjust it on input and just base64 decode it on output. There are
times where I want the actual base64 version (email springs to mind)
but usually I just refer to image_binary and send that.
then i manipulate the object accordingly.
But i got another strange behavior…!! In IE when i upload a gif image
of 2.60KB, it’s mime-type is seen as “image/pjpeg” ?? But when i upload
the same image in FF it’s correctly seen as “image/gif”!!!
I need to restrict the image-upload to png/jpg type of images… now i
don’t know how to sort out this issue…
Kindly help me to overcome this weird behavior in IE…
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.