Sha256: efd467f9dce4d5536872d2f53ce313e25bef65a3451f6b89c5fc9a8f7eecf009

Contents?: true

Size: 912 Bytes

Versions: 4

Compression:

Stored size: 912 Bytes

Contents

#!/usr/bin/env ruby -rubygems

require File.dirname(__FILE__) + '/authentication'

path = ::File.expand_path(File.dirname(__FILE__) + '/../spec/fixtures/image.png')
collection = StorageRoom::Collection.find('4e034b8db65245b72600002b')

# Upload Image or File
entry = collection.entry_class.new(:name => "StorageRoom Logo", :image => StorageRoom::Image.new_with_filename(path))

if entry.save 
  puts "Entry saved (#{entry[:@url]})"
  puts "URL of the uploaded image is #{entry.image.url}"
  puts "URL of the automatically generated thumbnail is #{entry.image.url(:thumbnail)}" # Multiple Image Versions can be specified in the interface
else
  puts "Entry could not be saved: #{entry.errors.join(', ')}"
end

# Remove Image or File

entry.image.remove = true

if entry.save
  puts "The Image of the Entry has been removed"
else
  puts "The Image of the Entry could not be removed: #{entry.errors.join(', ')}"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
storage_room-0.3.5 examples/upload_remove_image.rb
storage_room-0.3.4 examples/upload_remove_image.rb
storage_room-0.3.3 examples/upload_remove_image.rb
storage_room-0.3.2 examples/upload_remove_image.rb