Giter Site home page Giter Site logo

silverstripe-cloudassets-s3's People

Contributors

edlinklater avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

silverstripe-cloudassets-s3's Issues

Issue when uploading via HTMLEditorViewField Image upload

This gets an error after upload, I believe related to the resampled image. Here is the dump I get:

ERROR [Warning]: curl_setopt(): supplied argument is not a valid File-Handle resource
IN GET /admin/pages/edit/EditorToolbar/viewfile?ID=94
Line 247 in /Users/drye/Development/Crossroads/Milacron/SS-CMS/framework/api/RestfulService.php

Source
======
  238:      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  239:      curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  240:      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->getConnectTimeout());
  241:      if(!ini_get('open_basedir')) curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
  242:      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
  243: 
  244: 
  245:      // Write headers to a temporary file
  246:      $headerfd = tmpfile();
* 247:      curl_setopt($ch, CURLOPT_WRITEHEADER, $headerfd);
  248: 
  249:      // Add headers
  250:      if($this->customHeaders) {
  251:          $headers = array_merge((array)$this->customHeaders, (array)$headers);
  252:      }
  253: 

Trace
=====
curl_setopt(Resource id #425,10029,)
RestfulService.php:247

RestfulService->curlRequest(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png,GET,,,Array)
RestfulService.php:195

RestfulService->request()
Oembed.php:107

Oembed::autodiscover_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png)
Oembed.php:147

Oembed::get_oembed_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png)
HtmlEditorField.php:928

HtmlEditorField_Embed->__construct(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png,CloudImage)
HtmlEditorField.php:516

HtmlEditorField_Toolbar->viewfile(SS_HTTPRequest)
RequestHandler.php:288

RequestHandler->handleAction(SS_HTTPRequest,viewfile)
RequestHandler.php:200

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153

Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:443

LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93

AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370

Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153

Director::direct(/admin/pages/edit/EditorToolbar/viewfile,DataModel)
main.php:177

ERROR [Warning]: rewind() expects parameter 1 to be resource, boolean given
IN GET /admin/pages/edit/EditorToolbar/viewfile?ID=94
Line 284 in /Users/drye/Development/Crossroads/Milacron/SS-CMS/framework/api/RestfulService.php

Source
======
  275:          curl_setopt_array($ch, $this->proxy);
  276:      }
  277: 
  278:      // Set any custom options passed to the request() function
  279:      curl_setopt_array($ch, $curlOptions);
  280: 
  281:      // Run request
  282:      $body = curl_exec($ch);
  283: 
* 284:      rewind($headerfd);
  285:      $headers = stream_get_contents($headerfd);
  286:      fclose($headerfd);
  287: 
  288:      $response = $this->extractResponse($ch, $headers, $body);
  289:      curl_close($ch);
  290: 

Trace
=====
rewind()
RestfulService.php:284

RestfulService->curlRequest(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png,GET,,,Array)
RestfulService.php:195

RestfulService->request()
Oembed.php:107

Oembed::autodiscover_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png)
Oembed.php:147

Oembed::get_oembed_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png)
HtmlEditorField.php:928

HtmlEditorField_Embed->__construct(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png,CloudImage)
HtmlEditorField.php:516

HtmlEditorField_Toolbar->viewfile(SS_HTTPRequest)
RequestHandler.php:288

RequestHandler->handleAction(SS_HTTPRequest,viewfile)
RequestHandler.php:200

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153

Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:443

LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93

AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370

Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153

Director::direct(/admin/pages/edit/EditorToolbar/viewfile,DataModel)
main.php:177

ERROR [Warning]: stream_get_contents() expects parameter 1 to be resource, boolean given
IN GET /admin/pages/edit/EditorToolbar/viewfile?ID=94
Line 285 in /Users/drye/Development/Crossroads/Milacron/SS-CMS/framework/api/RestfulService.php

Source
======
  276:      }
  277: 
  278:      // Set any custom options passed to the request() function
  279:      curl_setopt_array($ch, $curlOptions);
  280: 
  281:      // Run request
  282:      $body = curl_exec($ch);
  283: 
  284:      rewind($headerfd);
* 285:      $headers = stream_get_contents($headerfd);
  286:      fclose($headerfd);
  287: 
  288:      $response = $this->extractResponse($ch, $headers, $body);
  289:      curl_close($ch);
  290: 
  291:      return $response;

Trace
=====
stream_get_contents()
RestfulService.php:285

RestfulService->curlRequest(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png,GET,,,Array)
RestfulService.php:195

RestfulService->request()
Oembed.php:107

Oembed::autodiscover_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png)
Oembed.php:147

Oembed::get_oembed_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png)
HtmlEditorField.php:928

HtmlEditorField_Embed->__construct(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png,CloudImage)
HtmlEditorField.php:516

HtmlEditorField_Toolbar->viewfile(SS_HTTPRequest)
RequestHandler.php:288

RequestHandler->handleAction(SS_HTTPRequest,viewfile)
RequestHandler.php:200

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153

Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:443

LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93

AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370

Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153

Director::direct(/admin/pages/edit/EditorToolbar/viewfile,DataModel)
main.php:177

ERROR [Warning]: fclose() expects parameter 1 to be resource, boolean given
IN GET /admin/pages/edit/EditorToolbar/viewfile?ID=94
Line 286 in /Users/drye/Development/Crossroads/Milacron/SS-CMS/framework/api/RestfulService.php

Source
======
  277: 
  278:      // Set any custom options passed to the request() function
  279:      curl_setopt_array($ch, $curlOptions);
  280: 
  281:      // Run request
  282:      $body = curl_exec($ch);
  283: 
  284:      rewind($headerfd);
  285:      $headers = stream_get_contents($headerfd);
* 286:      fclose($headerfd);
  287: 
  288:      $response = $this->extractResponse($ch, $headers, $body);
  289:      curl_close($ch);
  290: 
  291:      return $response;
  292:  }

Trace
=====
fclose()
RestfulService.php:286

RestfulService->curlRequest(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png,GET,,,Array)
RestfulService.php:195

RestfulService->request()
Oembed.php:107

Oembed::autodiscover_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png)
Oembed.php:147

Oembed::get_oembed_from_url(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png)
HtmlEditorField.php:928

HtmlEditorField_Embed->__construct(https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png,CloudImage)
HtmlEditorField.php:516

HtmlEditorField_Toolbar->viewfile(SS_HTTPRequest)
RequestHandler.php:288

RequestHandler->handleAction(SS_HTTPRequest,viewfile)
RequestHandler.php:200

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:222

RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153

Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:443

LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93

AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370

Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153

Director::direct(/admin/pages/edit/EditorToolbar/viewfile,DataModel)
main.php:177

<div class="ss-uploadfield-item embed ss-htmleditorfield-file template-upload" data-id="94" data-url="https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png">


    <div class="ss-uploadfield-item-preview">

            <span></span>

    </div>

    <div class="ss-uploadfield-item-info">
        <label class="ss-uploadfield-item-name">
            <span class="name" title="Screen-Shot-2015-05-04-at-4.07.42-PM.png (https:)">
                Screen-Shot-2015-05-04-at-4.07.42-PM.png (https:)
            </span>

            <div class="ss-uploadfield-item-status ui-state-success-text" title="Dimensions">
                1242 x 1106 (px)
            </div>


            <div class="clear"><!-- --></div> 
        </label>
        <div class="ss-uploadfield-item-actions">   
            <button data-icon="deleteLight" class="ss-uploadfield-item-cancel ss-uploadfield-item-remove" title="Remove">
                Remove
            </button>

            <div class="ss-uploadfield-item-edit edit">
                <button class="ss-uploadfield-item-edit ss-ui-button ui-corner-all" title="Edit this file" data-icon="pencil">
                    Edit
                    <span class="toggle-details">
                        <span class="toggle-details-icon"></span>
                    </span>
                </button>
            </div>
        </div>
        <div class="info">Info: This image will be hotlinked. Please ensure you have permissions from the original site creator to do so.</div>
        <div class="details ss-uploadfield-item-editform">
            <fieldset>

                    <div class="CompositeField composite cms-file-info nolabel ">




            <div class="CompositeField composite cms-file-info-preview nolabel ">




            <img id='thumbnailImage' class='thumbnail-preview' src='https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png?r=50055' alt='Screen-Shot-2015-05-04-at-4.07.42-PM.png (https:)' />





</div>




            <div class="CompositeField composite cms-file-info-data nolabel ">




            <div class="CompositeField composite nolabel ">




            <div id="FileType" class="field readonly">
    <label class="left" for="FileType">File type:</label>
    <div class="middleColumn">

    <span id="FileType" class="readonly">
        photo
    </span>


    </div>



</div>




            <div id="ClickableURL" class="field readonly text-wrap">
    <label class="left" for="ClickableURL">URL</label>
    <div class="middleColumn">

    <span id="ClickableURL" class="readonly text-wrap">
        <a href="https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png" target="_blank" class="file">https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png</a>
    </span>


    </div>



</div>





</div>





</div>





</div>


                    <div id="AltText" class="field text">
    <label class="left" for="AltText">Alternative text (alt) - shown if image cannot be displayed</label>
    <div class="middleColumn">
        <input type="text" name="AltText" value="Screen Shot 2015 05 04 at 4.07.42 PM" class="text" id="AltText" maxLength="80" size="30" />
    </div>



</div>


                    <div id="Title" class="field text">
    <label class="left" for="Title">Title text (tooltip) - for additional information about the image</label>
    <div class="middleColumn">
        <input type="text" name="Title" class="text" id="Title" />
    </div>



</div>


                    <div id="CaptionText" class="field text">
    <label class="left" for="CaptionText">Caption text</label>
    <div class="middleColumn">
        <input type="text" name="CaptionText" class="text" id="CaptionText" />
    </div>



</div>


                    <div id="CSSClass" class="field dropdown last">
    <label class="left" for="CSSClass">Alignment / style</label>
    <div class="middleColumn">
        <select name="CSSClass" class="dropdown last" id="CSSClass">

    <option value="leftAlone">On the left, on its own.</option>

    <option value="center">Centered, on its own.</option>

    <option value="left">On the left, with text wrapping around.</option>

    <option value="right">On the right, with text wrapping around.</option>

</select>

    </div>



</div>


                    <div  class="field fieldgroup dimensions last">
    <label class="left">Dimensions</label>

    <div class="middleColumn fieldgroup">

            <div class="fieldgroup-field first odd">
                <div class="fieldholder-small">
    <label class="fieldholder-small-label" for="Width">Width</label>
    <input type="text" name="Width" value="600" class="text" id="Width" maxLength="5" size="5" />

</div>
            </div>

            <div class="fieldgroup-field last even">
                <div class="fieldholder-small">
    <label class="fieldholder-small-label" for="Height">Height</label>
    <input type="text" name="Height" value="534" class="text" id="Height" maxLength="5" size="5" />

</div>
            </div>

    </div>



</div>


                    <input type="hidden" name="URL" value="https://s3.amazonaws.com/crds-cms-uploads/Screen-Shot-2015-05-04-at-4.07.42-PM.png" class="hidden nolabel" id="URL" />


            </fieldset>
        </div>
    </div>
</div>

Improve Error Handling

Hi Ed!

I can't seem to get the module to work and want to find out why it doesn't

Can you provide some sort of test build task so people can see if it can connect properly to the S3 server?

Thanks.

Cannot get it to work.

I have created created a bucket. The KEY and Secret are correct.
I have created cloudassets.yml

I have uploaded files but nothing is appearing in the bucket

/mysite/_config/cloudassets.yml

CloudAssets: 
    map: 'assets/Uploads'
    Type: S3Bucket 
    BaseURL: '' 
    Container: bucketname
    Region: location
    ApiKey: apikey
    ApiSecret: apisecret
    LocalCopy: true 

I have ran /dev/build/?flush=1

Am I missing anything?

Issue when i trying to upload image via UploadField

I'am installed packages via composer, framework version is 3.2.1, so when i trying to upload an image via UploadField i'am getting this error:

Object->__call(): the method 'parent' does not exist on 'Image'

any ideas where it comes from?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.