Hi, which is the best way to upload an image, keep that and also make a thumbnail? The images should not be stored in the database, but as normal image files in a specific directory. I think that for the thumbnail i should use rmagick, but for the upload ? (something which work with and without javascript, in every browser) Thanks :) -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Just curious, is there any special reason as to why you would not want them stored in the database? How will you be referencing back to the images later? I know this not helping you original question, but I was just curious to know why you would not want them stored. --Cory On Jul 11, 3:11 pm, Mix Mix <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, which is the best way to upload an image, keep that and also make a > thumbnail? > The images should not be stored in the database, but as normal image > files in a specific directory. > I think that for the thumbnail i should use rmagick, but for the upload > ? (something which work with and without javascript, in every browser) > Thanks :) > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try fleximage http://fleximage.rubyforge.org/ Gokhan www.sylow.net Mix Mix wrote:> Hi, which is the best way to upload an image, keep that and also make a > thumbnail? > The images should not be stored in the database, but as normal image > files in a specific directory. > I think that for the thumbnail i should use rmagick, but for the upload > ? (something which work with and without javascript, in every browser) > Thanks :)-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
CPerry wrote:> Just curious, is there any special reason as to why you would not want > them stored in the database? How will you be referencing back to the > images later? > > I know this not helping you original question, but I was just curious > to know why you would not want them stored. > > --CoryActually would not be a problem, but with a lot of images all with a thumbnail i think that the db dimension would grow exponentially and maybe decrease the performance, and also because with just images i can move them to another server and reference to it, without move all the db To reference them i think it''s important to save just the name and then load it in the view as a normal image, could be a possible solution? :)> Try fleximage > > http://fleximage.rubyforge.org/I think it could be quite heavy to resize on the fly images, especially when there are pages with 40 images, ok the cache, but isn''t better to resize them just one time and then use the thumb or the original when they are needed ? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I use attachment_fu with RMagick for this. It also supports lightweight image processors such as ImageScience. You can find a howto here: http://clarkware.com/cgi/blosxom/2007/02/24 Mike On 7/11/07, Mix Mix <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > CPerry wrote: > > Just curious, is there any special reason as to why you would not want > > them stored in the database? How will you be referencing back to the > > images later? > > > > I know this not helping you original question, but I was just curious > > to know why you would not want them stored. > > > > --Cory > > Actually would not be a problem, but with a lot of images all with a > thumbnail i think that the db dimension would grow exponentially and > maybe decrease the performance, and also because with just images i can > move them to another server and reference to it, without move all the db > To reference them i think it''s important to save just the name and then > load it in the view as a normal image, could be a possible solution? :) > > > > Try fleximage > > > > http://fleximage.rubyforge.org/ > > I think it could be quite heavy to resize on the fly images, especially > when there are pages with 40 images, ok the cache, but isn''t better to > resize them just one time and then use the thumb or the original when > they are needed ? > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''d do a system call to image magic''s convert program to make the thumbnail... about the best performance your going to get def thumbnail(temp, target) system( "/usr/local/bin/convert #{escape(temp)} -resize 48x48! #{escape(target)}" ) end DHH touches on this in "Outsourcing the performance-intensive functions" on this blog page: http://www.loudthinking.com/arc/2006_09.html Not really following you on what your asking about with the how to upload part of the question? and not sure what javascript has to do with it? It should just be a file-upload field as far as the browser goes. For saving on the server I do something like this in one of my models: def save_file(file_name, file) fh = File.open(file_name, ''w'') fh.write(file.read) fh.close end def image=(img) return if img.blank? save_file("/whatever/name/for_my_file.jpg", img) end good luck! Tim On Jul 11, 12:11 pm, Mix Mix <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, which is the best way to upload an image, keep that and also make a > thumbnail? > The images should not be stored in the database, but as normal image > files in a specific directory. > I think that for the thumbnail i should use rmagick, but for the upload > ? (something which work with and without javascript, in every browser) > Thanks :) > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mike Garey wrote:> I use attachment_fu with RMagick for this. It also supports > lightweight image processors such as ImageScience. You can find a > howto here: > > http://clarkware.com/cgi/blosxom/2007/02/24 > > Mikedoes rmagick take a lot of memory to make thumbnails? i don''t know if choose it or imagescience (that i think could be ok, because i''ve just to resize) -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I do resizing when they are hit first time and cache them. Gokhan www.sylow.net Mix Mix wrote:> >> Try fleximage >> >> http://fleximage.rubyforge.org/ > > I think it could be quite heavy to resize on the fly images, especially > when there are pages with 40 images, ok the cache, but isn''t better to > resize them just one time and then use the thumb or the original when > they are needed ?-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---