onjegolders Posted December 3, 2012 Share Posted December 3, 2012 Just realised that if I'm not logged in, then my images for my homepage slider (which is a repeater field with its images using the Crop module) don't show. I'm using the latest dev version of PW and am thinking this may well be to do with the new protected file system? My home template is accessible though so not to sure on where to go next? Link to comment Share on other sites More sharing options...
diogo Posted December 3, 2012 Share Posted December 3, 2012 What doesn't show, only the images or the repeaters themselves? Are you able to echo the titles for instance? Link to comment Share on other sites More sharing options...
onjegolders Posted December 3, 2012 Author Share Posted December 3, 2012 Hi Diogo, thanks for replying. Yes the other repeater content outputs just fine. Link to comment Share on other sites More sharing options...
diogo Posted December 3, 2012 Share Posted December 3, 2012 what about if you output the image normaly, without using the getThumb() method? edit: also, try to access the images directly, by pointing the browser to their url. Both, full version and cropped. Link to comment Share on other sites More sharing options...
onjegolders Posted December 3, 2012 Author Share Posted December 3, 2012 Strange I'm getting this as my img url: http://localhost/pw_template/admin/repeaters/for-field-134/for-page-1/1354274914-77-1/-/full_hands.jpg which is showing when logged in but giving me a 404 when not If I output normally with url, I still get blank images 1 Link to comment Share on other sites More sharing options...
ryan Posted December 4, 2012 Share Posted December 4, 2012 That's a bug (glad we have a dev branch). I'll work on this. 1 Link to comment Share on other sites More sharing options...
onjegolders Posted December 4, 2012 Author Share Posted December 4, 2012 Thanks Ryan! Link to comment Share on other sites More sharing options...
ryan Posted December 4, 2012 Share Posted December 4, 2012 Okay I think I've got this fixed. Would you mind trying it out and seeing if it also fixes it on your end too? It is on the latest commit to the dev branch. https://github.com/ryancramerdesign/ProcessWire/commit/7dab612baa55b7ca02a7d6679e70d1aef4298f8b It involved a re-thinking of what a repeater Page is. I've changed it so that repeater pages are now represented by their own class (RepeaterPage rather than Page). The new RepeaterPage is the same thing as a Page, but overrides the method used to determine when files should be secured or not (which it now delegates to its owning 'for' page) . It also adds 2 methods (see below) so that people don't have to do stuff like this to figure out what Page or Field a given repeater item belongs to. For those interested, these methods now appear on all repeater item pages: $page->getForPage(); // returns the owning Page this repeater item is for $page->getForField(); // returns the Field this repeater item belongs to 2 Link to comment Share on other sites More sharing options...
onjegolders Posted December 4, 2012 Author Share Posted December 4, 2012 Thanks Ryan that's sorted it. Am having another (sorry ) issue thought it could just be related to the crop module (and maybe I should post there?) If I try and edit the thumbnail before page save then I get an "invalid file" error. If I save the page and then edit the thumbnail, it all seems to work. I don't remember it working this way before, but may be wrong. Link to comment Share on other sites More sharing options...
ryan Posted December 5, 2012 Share Posted December 5, 2012 If I try and edit the thumbnail before page save then I get an "invalid file" error.If I save the page and then edit the thumbnail, it all seems to work. I don't remember it working this way before, but may be wrong. I just tried to reproduce this, but am not experiencing that particular issue here. Are there any other factors, like the page being unpublished or something? Link to comment Share on other sites More sharing options...
onjegolders Posted December 5, 2012 Author Share Posted December 5, 2012 Hmm nope, definitely published. It's a Cropimage field in a repeater in a fieldset Tab on the latest dev version. Not sure else what could affect it? Link to comment Share on other sites More sharing options...
ryan Posted December 6, 2012 Share Posted December 6, 2012 You might try moving it out of the tab, just to see, though I doubt that's it. If you are using an admin theme other than the default, you might also try switching back to the default, just in case. Lastly, double check that there aren't any errors in your JS console. Since you are no longer stuck, as it all starts working after you save, and I've not been able to reproduce it here, lets wait and see if someone else can. That might give more clues how to reproduce it. Link to comment Share on other sites More sharing options...
onjegolders Posted December 6, 2012 Author Share Posted December 6, 2012 Hiya Ryan, not getting any JS errors, this is the link for the second window http://localhost/pw_template/admin/page/image-crop/?filename=20121012_101025.jpg&prefix=full&width=1200&height=%20380&pages_id=1&field=image&modal=1 Moving it out of the tab doesn't have any effect, can only think that the file isn't getting set until page save? Link to comment Share on other sites More sharing options...
Alex Posted May 22, 2013 Share Posted May 22, 2013 Hi onjegolders, Was this ever solved?, I am also getting 'invalid file' error when i try and crop an image in a repeater before I save the page. The page is published and i'm using the thumbnails module, processwire 2.3 Do we need to save page after each upload in a repeater? Link to comment Share on other sites More sharing options...
vsulin Posted June 8, 2013 Share Posted June 8, 2013 Hi all, I also ran into a problem with Thumbnails module cropimage field inside a repeater. It does work with superuser account, but when I log in with an account that has all full access to root template (all other public pages have no access rules) and all but "Administer users"-permission. It gives the following error when trying to crop an image manually: Not EditableThe given error is twice in ProcessCropImage.module. This is the first one at line 58. I think it might be trying to check the "repeated page" and not the actual page for access. So the access from root/parent isn't inherited correctly to "pages inside repeater"? Or is the logic wrong when working with repeater-fields? Link to comment Share on other sites More sharing options...
ryan Posted June 9, 2013 Share Posted June 9, 2013 What version of PW are you running? I'll assume PW 2.3 stable unless you say otherwise. I think you may be right about the editable() check though. Though it looks to me like the module is performing the correct check. I might need to re-think a hook in FieldtypeRepeater to Page::editable. For now, try pasting this at the top of your /site/templates/admin.php: wire()->addHookAfter('Page::editable', function($event) { if($event->return) return; $page = $event->object; if($page instanceof RepeaterPage) { $event->return = $page->getForPage()->editable(); } }); Let me know if that fixes it? Link to comment Share on other sites More sharing options...
vsulin Posted June 9, 2013 Share Posted June 9, 2013 it is 2.3 stable. I added the given code before the default code and it gives the following error when just reloading the edit-page: /processwire/page/edit/ Error: Method name must be a string (line 293 of wire/core/Wire.php) Link to comment Share on other sites More sharing options...
Radek Posted June 12, 2013 Share Posted June 12, 2013 ryan, on 09 Jun 2013 - 14:27, said: What version of PW are you running? I'll assume PW 2.3 stable unless you say otherwise. I think you may be right about the editable() check though. Though it looks to me like the module is performing the correct check. I might need to re-think a hook in FieldtypeRepeater to Page::editable. For now, try pasting this at the top of your /site/templates/admin.php: wire()->addHookAfter('Page::editable', function($event) { if($event->return) return; $page = $event->object; if($page instanceof RepeaterPage) { $event->return = $page->getForPage()->editable(); } });Let me know if that fixes it? Hi Ryan, i have same problem. Another users than admin can not edit cropimage field in repeater. I tested your suggestion, but not working... Soma helped me thrue IRC and this workaround works for me: wire()->addHookAfter('Page::editable', null, 'hookEditable'); function hookEditable($event) { if($event->return) return; $page = $event->object; if($page instanceof RepeaterPage) { $event->return = $page->getForPage()->editable(); } } We tested some changes like: if(!wire("pages")->get((int) $this->input->get->pages_id)->editable()) throw new WirePermissionException('Not Editable'); or if(!$page->getForPage()->editable()) throw new WirePermissionException('Not Editable'); in ProcessCropImage.module (execute and executeSave functions) but more work will need to be done in cropimage module. 1 Link to comment Share on other sites More sharing options...
onjegolders Posted June 13, 2013 Author Share Posted June 13, 2013 Hi onjegolders, Was this ever solved?, I am also getting 'invalid file' error when i try and crop an image in a repeater before I save the page. The page is published and i'm using the thumbnails module, processwire 2.3 Do we need to save page after each upload in a repeater? Hi Alex, I still have the same issue, have to save the page before editing the crop. Link to comment Share on other sites More sharing options...
vsulin Posted June 15, 2013 Share Posted June 15, 2013 Hi Ryan, i have same problem. Another users than admin can not edit cropimage field in repeater. I tested your suggestion, but not working... Soma helped me thrue IRC and this workaround works for me: wire()->addHookAfter('Page::editable', null, 'hookEditable'); function hookEditable($event) { if($event->return) return; $page = $event->object; if($page instanceof RepeaterPage) { $event->return = $page->getForPage()->editable(); } } Hi, this also fixed it for me. I'll see if I can fix the module to work without the workaround now that were certain on the cause. As for the not being able to crop the image without saving. I don't really see that as a real problem. Link to comment Share on other sites More sharing options...
ryan Posted June 16, 2013 Share Posted June 16, 2013 I added the given code before the default code and it gives the following error when just reloading the edit-page: /processwire/page/edit/ Error: Method name must be a string (line 293 of wire/core/Wire.php) Sorry, I should have realized and mentioned: the code I posted requires ProcessWire 2.3 and PHP 5.3+. Thanks to Soma, you've also got the version that is compatible with PW 2.2.9 and PHP 5.2, above. Link to comment Share on other sites More sharing options...
Arklogic Posted July 3, 2014 Share Posted July 3, 2014 Still nothing with this error? I've the same here. Just an idea: maybe the 'invalid field' comes out because the image we uploaded is not saved to the page, so the cropimage modul can't decide which image should be cropped... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now