I get image url via API. It usualy have 360x200 but sometimes 233x350 etc.. I would like to crop them all to specific size 260x186. And show them using <%= image_tag image_url if hotel.images.first %> I dont want to store this images. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/CZcUVfr4hegJ. 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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jeremy Walker
2012-May-16 20:30 UTC
Re: How to crop and show external image with specific size?
On 16 May 2012 21:20, regedarek <dariusz.finster-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I get image url via API. It usualy have 360x200 but sometimes 233x350 etc.. > > I would like to crop them all to specific size 260x186. And show them > using > > <%= image_tag image_url if hotel.images.first %> > > I dont want to store this images. >You can use rmagic to crop the images but there''s going to be a time-cost here if you don''t have the images stored. Probably the best bet is to have image_url hit your application, crop the image and then use send_file, then delete the image. You might not want the request to go through your whole Rails stack here from a load POV. 10 images per page = an extra 10 requests to your application and these requests will take a bit of time to process the image so you could end up blocking actual requests. I''d setup a separate app using either using Sinatra, or a cut-down version of Rails with just the necessary stuff loaded. There''s also a big risk of caning your CPU here, if you have high volume. Storage is cheap - why not store them? tl;dr; Real-time image-cropping strikes me as a bad idea, but you could use rmagic on a separate application/server to do it. --> You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/CZcUVfr4hegJ. > 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 this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Lee Davis
2012-May-16 20:34 UTC
Re: How to crop and show external image with specific size?
On May 16, 2012, at 4:30 PM, Jeremy Walker wrote:> > > On 16 May 2012 21:20, regedarek <dariusz.finster-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > I get image url via API. It usualy have 360x200 but sometimes 233x350 etc.. > > I would like to crop them all to specific size 260x186. And show them using > > <%= image_tag image_url if hotel.images.first %> > > I dont want to store this images. > > You can use rmagic to crop the images but there''s going to be a time-cost here if you don''t have the images stored. Probably the best bet is to have image_url hit your application, crop the image and then use send_file, then delete the image. > > You might not want the request to go through your whole Rails stack here from a load POV. 10 images per page = an extra 10 requests to your application and these requests will take a bit of time to process the image so you could end up blocking actual requests. I''d setup a separate app using either using Sinatra, or a cut-down version of Rails with just the necessary stuff loaded. There''s also a big risk of caning your CPU here, if you have high volume. > > Storage is cheap - why not store them? > > tl;dr; Real-time image-cropping strikes me as a bad idea, but you could use rmagic on a separate application/server to do it.Take a look at Dragonfly, too. You get an API to use ImageMagick against your photos -- to crop, scale, grayscale, whatever -- and the images are cached. It runs in Rack, so it''s a ready-to-roll solution rather than you having to build a Sinatra app to do this. The only downside is that, out of the box, the URLs are amazingly long. Walter -- 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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2012-May-16 21:18 UTC
Re: How to crop and show external image with specific size?
On 16 May 2012 21:20, regedarek <dariusz.finster-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I get image url via API. It usualy have 360x200 but sometimes 233x350 etc.. > > I would like to crop them all to specific size 260x186. And show them using > > <%= image_tag image_url if hotel.images.first %>Can I just check that you do want to *crop* them, not just resize to a given size, in which case you could use the :size option of image_tag. Colin -- 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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
taler k.
2013-Jun-07 03:31 UTC
Re: How to crop and show external image with specific size?
hi there, quick searching on Google brings me here.and Im working on image cropping ,Is the kooboo source codes written in .Net? If yes ,Plz give me some detail guide,thx in adv.as a beginner in image programming ,I just can''t figure out which open source is best siuting me,like image crop sample codes (http://www.rasteredge.com/how-to/csharp-imaging/crop-image/) found by Google as well as your site.Anysuggestion is appreciated. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1f852d6b3980961c7f46f0876fbe40d1%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Tamara Temple
2013-Jun-07 04:16 UTC
Re: Re: How to crop and show external image with specific size?
taler k. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> hi there, quick searching on Google brings me here.and Im working on > image cropping ,Is the kooboo source codes written in .Net? If yes ,Plz > give me some detail guide,thx in adv.as a beginner in image programming > ,I just can''t figure out which open source is best siuting me,like image > crop sample codes > (http://www.rasteredge.com/how-to/csharp-imaging/crop-image/) found by > Google as well as your site.Anysuggestion is appreciated.Absolutely no idea how you managed to get here. This is about the Ruby on Rails web application development framework. Definitely nothing to with .NET, nor image processing. I can''t direct you to any .NET resources, but I can direct you to ImageMagick, which is the swiss army knife of image processing: http://www.imagemagick.org -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/51b15ead.3431320a.6dbd.ffff8f7a%40mx.google.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.