Sha256: 385ad2919c4964a0f937b233f87c37c2d8b40e5c7d00c7d206ac990eda639d00
Contents?: true
Size: 940 Bytes
Versions: 17
Compression:
Stored size: 940 Bytes
Contents
#!/usr/bin/env ruby -rubygems require File.join(File.dirname(__FILE__), 'authentication') path = ::File.expand_path(File.join(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
17 entries across 17 versions & 1 rubygems