Displaying 6 results from an estimated 6 matches for "image_field".
2006 Aug 15
8
AGAIN: file object treated as string
...le[''picture''].rewind
File.open("pictures/upload/#{@image.id}.#{@image.extention}", "wb") {
|f| f.write(uploaded_file[''picture''].read) }
end
end
MODEL:
class Image < ActiveRecord::Base
def picture=(image_field)
extname_dot = File.extname(image_field)
self.extention = extname_dot.slice(1,
extname_dot.length)
self.submitDate = Time.now
end
end
I tried implementing this with Agile web development rails book, and
also tried using other exa...
2006 May 30
1
Can''t read from file field second time around
...ium size image could not be saved"
end
else
@flash[:notice] = "Thumbnail image could not be saved"
end
else
@flash[:notice] = "No image was uploaded"
end
Here is the offending code from the model:
def listing_image=(image_field)
self.image = image_field.read
self.content_type = image_field.content_type.chomp
end
def resize
img = nil
img = Magick::Image.from_blob(self.image).first
img.format = "JPG"
case self.image_type
when "thumb"
img.strip!.change_geometry(...
2006 Jun 07
7
file_column image versions
does anyone know much about resizing different versions of images with
file_column? i tried it and everything works fine, but my question is
can you do more than just make sizes with a version of image? i''m
working on a photo album and i would like to resize the image to a
medium size, but create a thumbnail as well and crop anything left to
make the thumbnail a perfect square.
--
2006 Aug 15
0
file object treated as a string
...File.open("pictures/upload/#{@image.id}.#{@image.extention}", "wb") { |f| f.write(uploaded_file[''picture''].read) }
end
end
My image model looks like this:
class Image < ActiveRecord::Base
def picture=(image_field)
extname_dot = File.extname(image_field)
self.extention = extname_dot.slice(1, extname_dot.length)
self.submitDate = Time.now
end
end
When I click the submit button on the form, it saves the image entry in the database OK, but errors while...
2006 Mar 08
19
Creating multiple rows with one form
Hello. I''ve been trying this out for the past two days and I can''t seem to
get it. I''m going to have a page where you can upload x amount of images at
once. Lets say 10 images need to be uploaded, all with a caption.
I''d like to have a browse button to choose the file, then the caption. Now,
if I put 10 of them in one form, fill them all out and submit, I get
2006 Mar 05
2
How to clean up this code?
...''Product was successfully created.''
redirect_to :action => ''list''
else
render :action => ''new''
end
end
---------------------------
----- _form.rhtml partial (just the part of it) -----
<%= javascript_tag "var image_field_number=#{@file_fields_no}" %>
<label>Images</label>
<% if(controller.action_name == ''new'') %>
<% @product.images.each_with_index do |image, i| %>
<input type="file" id="images_<%=i%>_image_url"
name="images[<%...