Evening all!
I've decided to give it another shot with the image upload functionality provided with the tutorial 'RailsSpace'...
I've got further, in the fact that it recognizes an upload attempt, but fails with the message:
File upload failed. Try a different image?
I used a small-ish sized file (28k)
The max upload size is 1mb as seen within the def valid_file? action:
if @image.size > 1.megabyte errors.add(:image, "can't be bigger than 1 megabyte") return false
The error message I'm now getting is based within the 'successful_conversion? action:
def successful_conversion? # Prepare the filenames for the conversion. source = File.join("tmp", "#{@user.username}_full_size") full_size = File.join(DIRECTORY, filename) thumbnail = File.join(DIRECTORY, thumbnail_name) # Ensure that small and large images both work by writing to a normal file. # (Small files show up as StringIO, larger ones as Tempfiles.) File.open(source, "wb") { |f| f.write(@image.read) } # Convert the files. img = system("#{convert} #{source} -resize #{IMG_SIZE} # {full_size}") thumb = system("#{convert} #{source} -resize #{THUMB_SIZE} # {thumbnail}") File.delete(source) if File.exists?(source) # Both conversions must succeed, else it's an error. unless img and thumb errors.add_to_base("File upload failed. Try a different image?") return false end return true end
However - i dont understand why this hasn't uploaded...
Anyone else had this problem???
Thanks a lot for reading!