close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Configure PowerCMS inline editor to upload images to Amazon S3 storage

Thread began 1/17/2017 7:50 pm by Jason | Last modified 3/02/2017 3:50 pm by Jason | 142 views | 9 replies

Jason

Configure PowerCMS inline editor to upload images to Amazon S3 storage

I've got a function that I use already when posting a form to upload files to my amazon s3 storage, but I was hoping to be able to adapt this to the PowerCMS inline editor. Is there a way to do the same thing with the PowerCMS live edit?

php:
// WA_UploadResult1 Params Start

$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../../../public_who_we_are/images/",
'FileName' => "staff_photo_".((isset($file_name))? $file_name :"")."",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "200",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
'UploadFolder' => "../../../public_who_we_are/images/",
'FileName' => "large_staff_photo_".((isset($file_name))? $file_name :"")."",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "460",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_2 End
// WA_UploadResult1 Params End?>
<?php
WA_DFP_SetupUploadStatusStruct
("WA_UploadResult1");
if(
$_SERVER["REQUEST_METHOD"] == "POST"){
    
WA_DFP_UploadFiles("WA_UploadResult1""staff_photo""0""""JPG:100"$WA_UploadResult1_Params);

    
$aws_key $church_info->getColumnVal("s3_key"); //Change to new key
    
$aws_secret $church_info->getColumnVal("s3_secret"); //Change to new secret
    
$client S3Client::factory(array('credentials' => array('key' => $aws_key'secret' => $aws_secret), 'region' => 'us-east-1''version' => "2006-03-01"'http' => ['verify' => false])); //eventually need to change out http when using ssl for https
    
foreach($WA_UploadResult1_Params as $key => $value) {
        try{
            
$result $client->putObject(array(
                
'ACL'          => 'public-read',
                
'Bucket'       => $bucket//Bucket name
                
'Key'          => 'public_who_we_are/images/'.$value['FileName'].'.jpg'//This is the S3 file name (use slash for folders ex. smallgroups/filename.jpg)
                
'SourceFile'   => $value['UploadFolder'].''.$value['FileName'].'.jpg'//path to file
                
'StorageClass' => 'STANDARD',
            ));
        }
        catch(\
Aws\S3\Exception\S3Exception $e) {
            echo 
$e->getMessage();
        }
    }
    
//reference file using https://s3.amazonaws.com/$bucket/filename
}

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...