Max Williams
2007-Aug-07 13:14 UTC
image_tag weirdness - dodgy return value - HELP PLEASE!!!
Can anyone help? I''ve been going round in circles for two days, tearing my hair out trying to show a thumbnail and a full sized version of pictures i have stored in my appname/data/pictures folder. I''ve tried imagemagick/rmagick and got nowhere (several forum question already about that to no avail!), i''ve now gone back to just using image_tag to get the damn full size picture on screen with no luck. image_tag "picname.jpeg" works if i put the picture in the images folder, but i can''t make it navigate to my chosen pictures folder by going image_tag "/#{RAILS_ROOT}/data/pictures/picname.jpeg" - that returns the proper address with a slash in front. But, without the slash it starts looking from the images folder! So, i tried a really dirty method where i go up a couple of times from images and then back into my pictures folder, and then there''s a load of random looking digits stuck onto the file extension! ie, this <%= image_tag("../../data/pictures/pic32.jpeg") %> returns this <img alt="Pic32" src="/images/../../data/pictures/pic32.jpeg?1186162587" /> Where the hell does the "?1186162587" come from? Can anyone help please, i''m desperate here and ready to start breaking stuff. :( -- 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 -~----------~----~----~----~------~----~------~--~---
Max Williams
2007-Aug-07 13:56 UTC
Re: image_tag weirdness - dodgy return value - HELP PLEASE!!
Max Williams wrote: Actually, i found out about the random digits from another post (caching info). But that still doesn''t explain my utter lack of success in just showing an image. Can anyone help please? -- 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 -~----------~----~----~----~------~----~------~--~---
Max, Although from your rails app you can read/right anything on your system, your web server has limited access to you system (for good security reasons). I am running on a windows sytem with InstantRails, but the principles are the same. You need to know what the "public" directory is for your web server. For my InstantRails setup thats c:\InstantRails\rails_apps\app_name \public. That means all the assets/content/images I want my web server to serve need to be under that directory. It looks like this is not the case for you. Then my image tags are referenced with the idea the "/" is actually "c: \InstantRails\rails_apps\app_name\public". For example, I store my images in c:\InstantRails\rails_apps\app_name\public\catalog\images. My image_tags are all <%= image_tag /catalog/images/.... %> So I think your problems may be solved be (a) knowing what your public directory is for your web server configuration, (b) putting your content under that directory and (c) image_tag''ing based on that public directory being the root directory. Cheers, --Kip On Aug 7, 9:56 pm, Max Williams <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Max Williams wrote: > > Actually, i found out about the random digits from another post (caching > info). But that still doesn''t explain my utter lack of success in just > showing an image. Can anyone help please? > -- > 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 -~----------~----~----~----~------~----~------~--~---
Max Williams
2007-Aug-07 17:46 UTC
Re: image_tag weirdness - dodgy return value - HELP PLEASE!!
Kip wrote:> > So I think your problems may be solved be (a) knowing what your public > directory is for your web server configuration, (b) putting your > content under that directory and (c) image_tag''ing based on that > public directory being the root directory. > > Cheers, --Kip > > On Aug 7, 9:56 pm, Max Williams <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>ahhhhhh.......god damn it :) That has fixed my image_tag problems, thanks very very much! I suspected i was doing something quite fundamentally wrong since i was having so little success. :) I don''t suppose you also know about imagemagick_tag do you? (pushing my luck) That still isn''t working - i now have this in my controller imagemagick_for ''/data/pictures/'' and this in my view, which according to the guides i''ve seen on the net (such as http://vantulder.net/rails/magick/) should make imagemagick_tag look in the public/data/pictures folder, but instead makes it look (when i use it) in appname/imagemagick ? thanks a lot for your help! -- 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 -~----------~----~----~----~------~----~------~--~---
Max, I haven''t been down this path before. I use ImageMagick but not its tag helper. I had a quick read of the docs and have a couple of things for you at least to think about. 1. helper has full access to the data on your machine since its part of your Rails apps. So pathname you give it need to be real system path names (not web server relative). 2. The helper is going to take your existing fille (like "flower.jpeg") then apply some transformation. 3. It is going to have to save that transformed file somewhere so the web server can serve it. It looks like that it saves the resulting file in appname/imagemagick. But of course as you''ve worked out thats not available to your web server. So I guess the issue is how to have the helper save content it has transformed into a place the web server can see. Hope this helps a little, --Kip On Aug 8, 1:46 am, Max Williams <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Kip wrote: > > > So I think your problems may be solved be (a) knowing what your public > > directory is for your web server configuration, (b) putting your > > content under that directory and (c) image_tag''ing based on that > > public directory being the root directory. > > > Cheers, --Kip > > > On Aug 7, 9:56 pm, Max Williams <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > ahhhhhh.......god damn it :) > > That has fixed my image_tag problems, thanks very very much! I > suspected i was doing something quite fundamentally wrong since i was > having so little success. :) > > I don''t suppose you also know about imagemagick_tag do you? (pushing my > luck) That still isn''t working - i now have this in my controller > > imagemagick_for ''/data/pictures/'' > > and this in my view, which according to the guides i''ve seen on the net > (such ashttp://vantulder.net/rails/magick/) should make imagemagick_tag > look in the > public/data/pictures > folder, but instead makes it look (when i use it) in > appname/imagemagick > ? > > thanks a lot for your help! > -- > 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 -~----------~----~----~----~------~----~------~--~---
Max Williams
2007-Aug-08 08:42 UTC
Re: image_tag weirdness - dodgy return value - HELP PLEASE!!
Kip wrote:> > So I guess the issue is how to have the helper save content > it has transformed into a place the web server can see. >Thanks kip - i thought that''s what imagemagick_for ''/data/pictures/'' (in the controller) was supposed to do... I can use imagemagick to resize pictures (ie make thumbnails) and save them, i just can''t use it to display anything. I can get by with using the normal image_tag to display, so it''s not crucial, just annoying. thanks again for your help with the public folder issue, that was such a painful sticking point but i''m back working again now which is great. :) -- 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 -~----------~----~----~----~------~----~------~--~---