Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Pixlr Image Editor: How to make it work?


Go to End
Reply


9 Posts   3846 Views

Avatar
patjnr

Community Member, 101 Posts

19 October 2010 at 11:25pm

Hi

Pixlr Module

According to its writer (Marcus), this module is suppose to automatically add a button to the Image insertion panel to add new images via Pixlr, and add a button to the any images in your File and Images section to edit the image.

I have been trying to use this Module, which is available [url=http://github.com/nyeholt/silverstripe-pixlr/]here [/url] .
After renaming the module folder to pixlr, i got it partially working on under Files & Images and I could see the Edit This Image button as I was suppose to.

In the CMS after adding this

   public function getCMSFields()   {
      $f = parent::getCMSFields();
      $f->addFieldToTab("Root.Content.Image", new ImageField("Image"));
      return $f;
   }

I didnt see the Edit This Button.

Also on a website that has DOM installed, under Files & Images, nothing comes up.

thank you

PJ

Avatar
Marcus

Administrator, 87 Posts

19 October 2010 at 11:54pm

Edited: 19/10/2010 11:54pm

The "Add" button is available when you click the "Insert Image" action in the WYSIWYG editor for a content block

(image changed to URL for page breaking!)

[url]http://github.com/nyeholt/silverstripe-pixlr/raw/master/docs/add-image.png[/url]

Unfortunately it looks like DOM makes some changes to the structure of form within image popups, meaning certain tabs aren't available as usual. I'll have to look into whether this needs to be handled specifically or not; normally, it should appear as per below

Avatar
DsX

Community Member, 178 Posts

21 October 2010 at 8:33am

I am very interested in see it work with DOM as I am sure many others are.

Avatar
Marcus

Administrator, 87 Posts

22 October 2010 at 3:50am

I have just made a commit that works around some of the issues to make it work better with DOM. One thing though is that DOM needs to be patched to allow the custom asset manager load up appropriate popups depending on what the type of the file actually is (instead of it being hardcoded to File).

I've attached the .diff for dataobject_manager below; you can apply it by running

patch -p0 < /path/to/file.diff

when you're in the top level of your SilverStripe directory. Alternately, the PHP file is attached too. I'll try and get in touch with Uncle Cheese to see whether he wants these added to the module.

Avatar
patjnr

Community Member, 101 Posts

23 October 2010 at 1:43am

Hi

To save time dumped the new AssetsManager in DOM and here is the thing ..

if you have DOM installed, first you have to add these lines in the _config.php

DataObjectManager::allow_assets_override(false);
DataObjectManager::allow_css_override(false);

otherwise you will get this error
[User Error] FieldSet::addFieldToTab() Tried to add a tab to object 'FieldSet' - 'BottomRoot' didn't exist.

The other problem is if you are viewing the image inside a pop_up, everything will be bundled inside that small pop_up.

It would be nice have the edit button on every ImageField. Does this Work?

$f->addFieldToTab("Root.Content.Image", new ImageField("Image"));

Also why can it replace the cropped Image on save or maybe ask to replace or create a new one. Otherwise the assets folder is going to be multiplied by 2 (cropped and raw image).

thx

PAt

Avatar
Marcus

Administrator, 87 Posts

25 October 2010 at 10:05pm

That's a good idea having it directly on ImageField controls - I've added it to the github tracker.

Avatar
hp777

Community Member, 12 Posts

13 May 2011 at 12:19am

Hi Marcus
I made the changes from the files above but I'm getting this error any Idea? Think its a typo or quoting issue but I can't find it.

Failed to load resource: the server responded with a status of 500 (Warning: "RegexIterator::__construct() [<a href='regexiterator.--construct'>regexiterator.--construct</a>]: Compilation failed: unrecognized character after (?&lt; at offset 3" at line 110 of /++++/www/vhosts/++++++.com/http/pixlr/code/decorators/PixlrImageDecorator.php)

Avatar
Marcus

Administrator, 87 Posts

16 May 2011 at 1:52pm

What version of PHP are you using? I have a feeling it's a small incompatibility with the regex being used on older versions of PHP5

Go to Top