close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

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 Ray Borduin | 115 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
}
Sign in to reply to this post

Ray BorduinWebAssist

We could probably pull this off, but it would take some digging around in the code and some hand coding to do. I could help with something like that in a premier support ticket.

Sign in to reply to this post

Jason

Would we be able to get it to function just like it does on the local server? Browse the files and what not, but in the s3 bucket instead of the local folder.

Sign in to reply to this post

Ray BorduinWebAssist

Yes that should be possible. We will just have to track down the code in the ckeditor that does the upload and then adjust it to use the code you referenced above instead.

Sign in to reply to this post

Jason

Lets do it then.

Sign in to reply to this post

Vine Church

This is the profile I was referring to Ray.

Sign in to reply to this post

Ray BorduinWebAssist

Go ahead and fill out the premier support request form: http://www.webassist.com/premier_request.php

Then I will contact you to schedule the call.

Sign in to reply to this post

Vine Church

Done. I put dates for the rest of this week, but I'm actually free for the next 4 hours today if you happen to get time and wanted to do it now.

Sign in to reply to this post

Vine Church

Hey Ray, I submitted the support request like you said, but never heard back from you. Should I submit another one?

Sign in to reply to this post

Ray BorduinWebAssist

Yes, sorry I must have missed it. Please post a new request and I'll get in contact with you to make an appointment.

Sign in to reply to this post
loading

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...