Martijn Geerts Posted October 11, 2013 Posted October 11, 2013 <horst>Could it be that there wasn't a 100% transparency at this images parts?</horst> Looks like imagealphablending issue or something. I'm not realy into images, but I know raymond works precise with images/photoshop. 1
LeiHa Posted November 3, 2013 Posted November 3, 2013 Hey guys. Have some question here. I've put img_user field on the user to add thumbnail image. And this code works perfectly well as expected. echo $user->img_user->eq(0)->getThumb('thumbnail'); However, I need to use this code my custom made function in it. So, I've tried several way to work out. echo wire('page')->createdUser->img_user->eq(0)->getThumb('thumbnail'); Now, using createdUser doesn't seem to work here. Any idea what would be the problem in here? Thank you =D
ryan Posted November 6, 2013 Posted November 6, 2013 Check what createdUser is resolving to, and make sure it is what you expect. $createduser = wire("page")->createdUser; echo $createdUser->name; // is it showing the user you expect?
LeiHa Posted November 7, 2013 Posted November 7, 2013 well. Check what createdUser is resolving to, and make sure it is what you expect. $createduser = wire("page")->createdUser; echo $createdUser->name; // is it showing the user you expect? That didn't work. Nothing shows on the screen. But, this works below. wire("page")->createdUser->name; This properly shows as expected, which is 'admin'. I guess there is something wrong with it. Thanks Ryan.
apeisa Posted November 7, 2013 Author Posted November 7, 2013 There is just a typo on Ryan's example: $createduser and $createdUser.
LeiHa Posted November 8, 2013 Posted November 8, 2013 There is just a typo on Ryan's example: $createduser and $createdUser. Oh, I didn't notice that point. Fixed and works well this time. But, I'm still having issue with thumbnail. $createduser = wire("page")->createdUser; echo $createduser->name; // is it showing the user you expect? echo $createduser->img_lg->eq(0)->getThumb('thumbnail'); added to get a thumbnail url above and got a error message. Error: Exception: Method Pageimage::eq does not exist or is not callable in this context (in C:\wamp\www\ktest\wire\core\Wire.php line 232) #0 C:\wamp\www\ktest\site\templates\test.php(57): Wire->__call('eq', Array) #1 C:\wamp\www\ktest\site\templates\test.php(57): Pageimage->eq(0) #2 C:\wamp\www\ktest\wire\core\TemplateFile.php(125): require('C:\wamp\www\kte...') #3 [internal function]: TemplateFile->___render() #4 C:\wamp\www\ktest\wire\core\Wire.php(271): call_user_func_array(Array, Array) #5 C:\wamp\www\ktest\wire\core\Wire.php(229): Wire->runHooks('render', Array) #6 C:\wamp\www\ktest\wire\modules\PageRender.module(250): Wire->__call('render', Array) #7 C:\wamp\www\ktest\wire\modules\PageRender.module(250): TemplateFile->render() #8 [internal function]: PageRender->___renderPage(Object(HookEvent)) #9 C:\wamp\www\ktest\wire\core\Wire.php(271): call_user_func_array(Array, Array) #10 C:\wamp\www\ktest\wire\core\Wire.php(229): Wire->runHooks('renderPage', Array) #11 C:\wamp\www\ktest\wire\core\Wire.php(293): Wire- This error message was shown because you are logged in as a Superuser. Error has been logged.
apeisa Posted November 8, 2013 Author Posted November 8, 2013 Take the ->eq(0) away, you have single image, not array.
LeiHa Posted November 9, 2013 Posted November 9, 2013 Take the ->eq(0) away, you have single image, not array. Thanks apeisa. taking out of eq(0) makes work fine. I've been testing some of this issue with different way. $createduser = wire("page")->createdUser; echo $createduser->name; // is it showing the user you expect? echo $createduser->img_user->getThumb('thumbnail'); Since this works, I've put wire('user') on the first line. $createduser = wire("user"); echo $createduser->name; // is it showing the user you expect? echo $createduser->img_user->getThumb('thumbnail'); This time, I got an error. Error: Exception: Method Pageimages::getThumb does not exist or is not callable in this context
adrian Posted November 13, 2013 Posted November 13, 2013 LeiHa, $createduser = wire("user"); will get you the currently logged in user, or "guest", rather than the user that created the current page. Is that really what you are looking for? Have a read of this: http://processwire.com/api/variables/user/
LeiHa Posted November 14, 2013 Posted November 14, 2013 What I was trying to do is to put user image thumbnail on the user. Whenever showing a post, user image thumbnail should be displayed along with a post. And I didn't know what caused the problem before. Thanks to apeisa. I got to narrow down the problem. wire('user') pull out the current user information. Now that, I also need to pull out current logged in user information. So that I can get the current user image thumbnail on the writing new post page, that current user is about to create. But, somehow, I got an error. And I'm thinking this causes error on my code. Thank you all. It is so grateful.
adrian Posted November 14, 2013 Posted November 14, 2013 I am not really sure exactly why you are getting that error, although my hunch is that you have the opposite problem that apeisa identified earlier with the $createduser->img_lg field. It sounds like that one was set to single image, but the img_user is set to multiple, so you need to either use first() or eq(0) or change it to be single image. Does that work? I assume img_user is set to type CropImage?
LeiHa Posted November 15, 2013 Posted November 15, 2013 Okay, I don't know why, but, img_user field is the CropImage and single image only. Some page works fine, some other page doesn't work. I've tested code below. $createduser = wire("page")->createdUser; echo $createduser->name; // is it showing the user you expect? echo $createduser->img_user->getThumb('thumbnail'); echo ' ' . wire('user')->name; echo wire('user')->img_user->getThumb('thumbnail'); At the home page, this code doesn't work. Result shows like this. testadmin Error: Call to a member function getThumb() on a non-object At the any child page of home page, Everything works fine. I guess this must be caused some other place. Thank you guys.
adrian Posted November 15, 2013 Posted November 15, 2013 From your code and the output, I can't tell which echo statements are working and which ones aren't. Try something like this and let us know the output / error for each one. $createduser = wire("page")->createdUser; echo 'Created User: ' . $createduser->name . '<br />'; echo 'Created User Thumb: ' . $createduser->img_user->getThumb('thumbnail') . '<br />'; echo 'Current User: ' . wire('user')->name . '<br />'; echo 'Current User Thumb: ' . wire('user')->img_user->getThumb('thumbnail');
LeiHa Posted November 15, 2013 Posted November 15, 2013 From your code and the output, I can't tell which echo statements are working and which ones aren't. Try something like this and let us know the output / error for each one. $createduser = wire("page")->createdUser; echo 'Created User: ' . $createduser->name . '<br />'; echo 'Created User Thumb: ' . $createduser->img_user->getThumb('thumbnail') . '<br />'; echo 'Current User: ' . wire('user')->name . '<br />'; echo 'Current User Thumb: ' . wire('user')->img_user->getThumb('thumbnail'); Thanks for your interest, adrian. I've tested the code adrian suggested above at the home page. Created User: admin Error: Call to a member function getThumb() on a non-object (line 38 of C:\wamp\www\site\templates\home.php) And tested on the sub page of the home, which named 'test'. Created User: admin Created User Thumb: /site/assets/files/41/thumbnail_contact_img.jpg Current User: admin Current User Thumb: /site/assets/files/41/thumbnail_contact_img.jpg Seems working fine this time. Thank you so much. =D
adrian Posted November 15, 2013 Posted November 15, 2013 Ok, so the issue with the homepage is that it is created by a built in user called "admin" which doesn't actually exist in the users list so I am pretty sure you don't have a img_user image for that user. Did you create another user called admin yourself? Try running this: $createduser = wire("page")->createdUser; echo 'Created User: ' . $createduser->id . '<br />'; echo 'Current User: ' . wire('user')->id . '<br />'; I think you should see "2" for the Created User when on the homepage and a higher number somewhere in the thousands for the Current User.
LeiHa Posted November 15, 2013 Posted November 15, 2013 Ok, so the issue with the homepage is that it is created by a built in user called "admin" which doesn't actually exist in the users list so I am pretty sure you don't have a img_user image for that user. Did you create another user called admin yourself? Try running this: $createduser = wire("page")->createdUser; echo 'Created User: ' . $createduser->id . '<br />'; echo 'Current User: ' . wire('user')->id . '<br />'; I think you should see "2" for the Created User when on the homepage and a higher number somewhere in the thousands for the Current User. Oh yes it is. It is showing '2' on the first line. Indeed, I named 'admin' for the default superuser when I installed PW at the first time. I guess this is why I got stuck. Thank you so much to help me, adrian. =D 1
landitus Posted December 3, 2013 Posted December 3, 2013 I'm getting the following error after updating to the latest version of the plugin. I've got it working in my local machine but in the server it shows the following error (image attached). The server has PHP version 5.3.20 installed.
landitus Posted December 4, 2013 Posted December 4, 2013 check and resave field settings. Oh! I had the old plugin in the modules directory. I deleted the old plugin and now it works!!
Gregor G. Posted December 16, 2013 Posted December 16, 2013 er, so how do I get round that? Since this error is on the module upload itself. Interestingly, when it says There is no thumb called ... there is no name after the word called. I checked directory permissions, by the way, and they seem okay. The images field is uploading fine. I had the same issue and solved it without recreating the field, so I'm posting my solution for others that may face it (and for the developper who could solve it by sanatizing input properly ) The solution is simply to check if there are any blank lines after the last crop dimension in the Input > Thumbnail Settings field and delete them. Note for the developper of the module: a simple trim($crops) (preferably during input) will make this problem disapear. By the way: this module really rocks! 1
peterfoeng Posted December 22, 2013 Posted December 22, 2013 Hi all, Just wondering if there is a way to only specify height value or width value for this module? Thanks
iNoize Posted January 9, 2014 Posted January 9, 2014 Awsome Thanks for this Module, i need to handle a gallery page with many galleries and the have to be sorted. The Problem is that each gallery contains abot 200 Pictures. Its possible to display cropImages as a grid ? Like the standard images ? http://prntscr.com/2hxlc4 Or its better in this case to use the standart image field and manipulate the images with Image Manipulator http://modules.processwire.com/modules/page-image-manipulator/ 1
apeisa Posted January 9, 2014 Author Posted January 9, 2014 Just wondering if there is a way to only specify height value or width value for this module? Thanks No, not at the moment at least. Its possible to display cropImages as a grid ? Like the standard images ? Hmm, haven't thought about that. I just glanced the code and it shouldn't be much to get that working. I actually wonder why it doesn't - maybe the added cropping link is messing things or some init() is missing. Does it throw any errors on js console?
Manfred62 Posted January 14, 2014 Posted January 14, 2014 I've made a translation (german) for the thumbnails module. Under '/site/modules/Thumbnails/ProcessCropImage/ProcessCropImage.module' I changed line 364 to $p->title = $this->_("Image crop"); to get the title of the screen (after you click 'crop and go') translated. In the translation file the input is available, but the screen isn't translated? Any hints?
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