Skip to content
JoshuaEstes edited this page Dec 30, 2010 · 2 revisions

Home > Installation

todo: Update this page =\

This plugin allows you to connect to Amazon s3 services. You should note that you WILL NEED the Zend library for this. It needs to be installed in lib/vendor/Zend

Place this function in the ProjectConfiguration.class.php file:

static public function registerZend() { if (!self::$_ZendAutoloader) { set_include_path(implode(PATH_SEPARATOR, array( sfConfig::get('sf_lib_dir').'/vendor', get_include_path(), )));

  require_once 'Zend/Loader/Autoloader.php';
  self::$_ZendAutoloader = Zend_Loader_Autoloader::getInstance();
}
return self::$_ZendAutoloader;

} In the same file add this variable to the top of the class:

static protected $_ZendAutoloader = false; If you have already added something similar in this file then you should be good as long as the function 'registerZend()' is in there and it is static.

app.yml

prod:
  amazon_s3:
    enabled: true
    bucket:  BUCKET NAME

dev:
  amazon_s3:
    enabled: true
    bucket:  BUCKET NAME

test:
  amazon_s3:
    enabled: true
    bucket:  BUCKET NAME

all:
  amazon_s3:
    access_key: PLACE ACCESS KEY HERE
    secret_key: PLACE SECRET KEY HERE

by default, amazon s3 is configured to be off by default, if you wish to have it turned on by default the set 'enabled: true' for all

In you upload form update the widget that has the widget InputFile or similar widget.

$this->widgetSchema['image'] = new sfWidgetFormInputFile();
$this->validatorSchema[image'] = new sfValidatorFile(array(
  'mime_types' => 'web_images',
  'path' => sfConfig::get('sf_upload_write_dir').'/user_uploads',
  'validated_file_class' => 'sfValidatedAmazonS3File'
));
Clone this wiki locally