search for: public_filename

Displaying 20 results from an estimated 26 matches for "public_filename".

2007 Oct 24
4
RAILS_ROOT
Hey, I''m using the attachment_fu plugin to upload images on the file system. To retrieve them I''m using: image = "/home/rajeev/Desktop/logo/logo/public#{icon.public_filename}" which is the same as: "/home/rajeev/Desktop/logo/logo/public/icons/0000/0005/green_nature_on_white.jpg" Have can i do this in a shorter way by using RAILS_ROOT? I have tried this but no success. Would appreciate any help. Thanks Raj -- Posted via http://www.ruby-forum.com/....
2008 Jul 07
6
MiniMagick, and processing thumbnails...
...- call after_resize - (DO MY STUFF) This modified image is now the basis for the thumbnails. Therefore, the after_resize gets called with an image that already has a border attached. I think this is wrong... I''ve ended up doing this after the main photo model has been saved: [ @photo.public_filename, @photo.public_filename( :thumb ), @photo.public_filename( :medium ), @photo.public_filename( :large )].each do |path| path = "#{RAILS_ROOT}/public/#{path}" file = MiniMagick::Image.from_file( path ) file.combine_options do |i| i.gravity ''...
2007 Dec 18
2
attachment_fu and S3 -- cannot download file correctly
...a word doc that I uploaded, all I get is the S3 file path in the document. If I access the s3 file path directly in my browser, it downloads the file correctly. Here is my controller method: def download @curriculum = @school.curriculums.find(params[:id]) send_data @curriculum.attachment.public_filename, :filename => @curriculum.attachment.filename, :type => @curriculum.attachment.content_type end view: link_to curriculum.attachment.filename.split(''.'').first, :action => ''download'', :id => curriculum.id The file is downloaded, but not...
2009 Jul 24
1
Attachment_fu - watermark tmp file before saved to S3
...ystem storage option using the code below. # -------------------------------------------- watermark on file_system after initial save - but doesn''t work for s3 def after_attachment_saved unless self.thumbnail? dst = Magick::Image.read("#{RAILS_ROOT}/public/# {self.public_filename}").first src = Magick::Image.read("#{RAILS_ROOT}/config/ logo.png").first result = dst.composite(src, Magick::SouthEastGravity, Magick::OverCompositeOp) result.write("#{RAILS_ROOT}/public/#{self.public_filename}") end end Now I'...
2007 Sep 18
2
Making attachment_fu polymorphic
...#39;s class will be Product_attachment). ## Attachments, after they are saved, can be called either with the Attachment class (or whatever you ## created as your Attachment_fu model) or by the usual polymorphic means. All of the usual methods ## are available from Attachment_fu (like public_filename etc.) ## For a more on polymorphic Models see Chad Fowler''s Rails Recipes. ################################### FAIR WARNING ############################################## ## The new_attachment method makes use of EVAL. In case you don''t know, eval runs whatever string...
2008 Jul 29
1
can't crop images using ImageMagick
...rano deployed server. Here''s my code: require ''RMagick'' top_square = params[:top_square].to_d left_square = params[:left_square].to_d width_square = params[:width_square].to_d height_square = params[:height_square].to_d source_file = "#{RAILS_ROOT}/public#{@photo.public_filename}" destination_file = "#{RAILS_ROOT}/public#{city_photo.public_filename}" img = Magick::Image.read(source_file).first img.crop!(left_square, top_square, width_square, height_square) img.write destination_file Thanks, Andy --~--~---------~--~----~------------~-------~--~----~ You re...
2008 Feb 29
4
App design question: user_photo helper
...cation helper and understanding how I should make it work throughout my application - so if you can help me with this I''ll be overcoming a big hurdle in my learning. Here''s the helper method; [code=]# application_helper.rb def user_photo if @user.photo? return @user.photo.public_filename(:thumb) else return ''rails.png'' end end[/code] Pretty simple. I understand what it does, and it works just fine in my show action in the user controller; [code=]# user_controller.rb def show @user = User.find(params[:id]) end[/code] [code=]# show.html.erb <h2>...
2007 Jun 27
5
How to make attachment_fu generate RESTFUL URL
hi folks: I follow this article:http://clarkware.com/cgi/blosxom/2007/02/24 all goes well except the public_filename ,it return something like "photos/0000/0001/test.jpg" ,not the expected RESTFUL URL LIKE ''photos/1/test.jpg'',any suggestion? My Env is Rails 1.2.3 on Ruby 1.8.6 with attachment_fu from http ://svn.techno-weenie.net/projects/plugins/attachment_fu/ by now -- Posted via h...
2008 Feb 11
1
image_tag is it just plain Broken?
...error: ActionView::TemplateError (undefined method `image_tag'' for #<Gallery: 0xb7083be4>) on line #23 of app/views/users/index.rhtml This is my definition of link_to def link_to unless self.thumbnail_id == 0 picture = Picture.find(self.thumbnail_id) path = picture.public_filename(:big_thumb) return "#{path}" else return "" end end Any idea about that error? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to...
2008 May 24
1
link_to_remote, image_tag, mouseover is this possible?
Hi guys, I was wondering if you are able to have a link_to_remote, having an image_tag and the link_to_remote has a mouseover event that updates a div. Does the image_tag need the mouseover event? I currently have: <%= link_to_remote(image_tag(@p_image.public_filename(:thumb)), :update => "big_pic", :onmouseover => {:action => :color_change, :id => @p_image.id})%> I get this error on loading my page: You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occurred w...
2008 Sep 25
2
jquery, format.js and IE
...beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} } And my respond_to block: respond_to do |format| format.html { redirect_to edit_picture_path(@picture) } format.js { render :json => @picture.to_json(:methods => [:public_filename, :large_thumb]) } end Any suggestions? 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...
2007 Aug 22
8
How to spec an attachment_fu model
First off, I''m not trying to spec attachment_fu, I know it''s been tested. But, I added some code to that model that I do need to test. Basically, I need to somehow fulfill the "uploaded_data" property so I can actually run my tests(otherwise they fail because of validations). The "uploaded_data" field is what would grab the multipart data from form. Here
2008 Sep 23
5
Problem getting Rails to emit the correct (proxy) domain in route urls
Behind the scenes my app runs like this: http://myapp.mydomain.com/myapp and and https://myapp.mydomain.com/myapp are Apache 2.2 virtual hosts proxy-balanced to a mongrel cluster on the same machine. But I need to make these available here: https://www.mydomain.com/myapp and https://myapp.mydomain.com/myapp are on a second server using ProxyPass and ProxyPassReverse to
2007 May 07
1
attachment_fu seems to be searching the wrong location for my images
...;} #Create one thumbnail 120x90 validates_as_attachment end In my Product model, I have a method to return the file path for simplification or a stock image if not found: def photo_filename retval = "/images/no_image.gif" unless not photo.nil? then retval = photo.public_filename end retval end For some reason, Product.photo_filename keeps returning my $HOME directory: No such file or directory - "/Users/stamosunas" The whole trace is below... it seems to be in the attachment_fu code itself where there is a problem: /Applications/Locomotive2/Bundles/...
2007 Jun 17
1
actionmailer & picture
...equest'' for #<UserMailer:0x44c58ac> Extracted source (around line #9): 6: <% if p.nil? %> 7: <%= image_tag("no_pic.jpg", :alt => "user picture", :class => "friendPic") %><br> 8: <% else %> 9: <%= image_tag(p.public_filename(:small), :alt => "user picture", :class => "friendPic")%> 10: <% end %> 11: </tr></td> 12: <tr><td align="center"> Trace of template inclusion: /app/views/user_mailer/vic_announcement.rhtml RAILS_ROOT: ./script/../config/....
2007 Sep 03
0
Attachment_fu won't upload images to S3 on Windows XP?
...XP machine and using Amazon''s S3? Would you mind sharing what changes you made to attachment_fu to make the photos upload correctly? S3 gets a VERY few bytes such as 25 bytes for a 370k graphic file. When I show the graphic all I see is a ''placeholder'' where the :thumb or public_filename should go. Any help is greatly appreciated. Kathy --~--~---------~--~----~------------~-------~--~----~ 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@pub...
2007 Dec 06
0
saving the user id for thumbnails using attachment_fu
...re is no user with that id. Is there any way to get attachment_fu to save the user_id to the thumbails too? Perhaps there is some other solution. Heres the code for the avatars so you can get a sense for what I am trying to do: <% for avatar in @avatar -%> <%= link_to image_tag(avatar.public_filename()), {:action => "index", :controller => "users", :user_id => avatar.user_id } %> <% end %> So this user_id is 0 b/c the attachment_fu didnt save the user_id Any ideas are greatly appreciated. Thanks, Dave --~--~---------~--~----~------------~-------~--~----...
2009 Jan 24
0
reprocess attachment_fu thumbnails with ImageMagick edits
...geMagick modifications don''t stick. Here is what I''ve got going so far: def before_save if self.sold_changed? && self.sold? for photo in self.photos imagelist = Magick::ImageList.new imagelist.read(File.join(RAILS_ROOT, "public", photo.public_filename), File.join(RAILS_ROOT, "assets", "sold.png")) imagelist.flatten_images.write(photo_file) photo.save! end end end Does anyone know why calling ''photo.save!'' would discard my ImageMagick changes? When I try the same function without c...
2009 Apr 28
0
strange path errors
...for some users, but others I am getting path errors such that I cant log in e.g. user_photo_url failed to generate from :controller=>"user_photos", :user_id=>#<User id: 2, user_name:...... This path is in my user profile view: 1: <li> 2: <%= link_to image_tag(photo.public_filename(''thumb'')), 3: user_photo_path(:user_id => photo.user, :id => photo) %> 4: </li> Even with the users that can login, I am getting other "failed to Generate" path errors. Does anyone know why this would happen? The only thing I can think of i...
2010 Jul 11
0
Attachement_fu error when updating existing photos
...vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:369:in `temp_paths'' /vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:354:in `uploaded_data='' My ruby code: <% form_for(@photo) do |f| %> <%= f.error_messages %> <%= image_tag(@photo.public_filename, :BORDER=>0) %> <p> <label for="upload">Upload new photo:</label> <%= f.file_field :uploaded_data %> <%= f.submit ''Update'' %> </p> <% end %> My rails code: def edit @photo = Photo.find(params[:id]) end d...