videokid Posted February 18, 2015 Posted February 18, 2015 Serious might be a bit too much, but on the frontend getCrop('small') is being regenerated each time the page is called. In the back-end uploading goes as expected. This is in a local set-up, not tested on live server. Hope this helps a bit.
Fokke Posted February 18, 2015 Posted February 18, 2015 I have the same problem. $page->imageCrop->getCrop('test')->url The thumbnail will be regenerated every time the page is reloaded. This will happen in both frontend and backend. Using 2.5.19 dev
horst Posted February 18, 2015 Author Posted February 18, 2015 This doesn't help me much because I have tested it today with PW 2.5.19 dev and it works well with caching here. ?? Maybe there is something different with previously installed and used fields, (before upgrading PW to 2.5.18 or 2.5.19) in regard to new created fields? Another thing you may test is a check for forceNew just before you call the getCrop: $forceNew = isset($config->imageSizerOptions['forceNew']) ? $config->imageSizerOptions['forceNew'] : false; $forceNew = $forceNew ? '<p>forceNew is ON</p>' : '<p>forceNew is off</p>'; $page->imageCrop->getCrop('test')->url;
Martijn Geerts Posted February 18, 2015 Posted February 18, 2015 There was something with the prefix names (not created) in PIM in previous dev version. Haven't tested latest 2.5.19, so I suspect it was a core issue. I will do some test tonight for CroppableImage. 1
onjegolders Posted February 18, 2015 Posted February 18, 2015 Sorry Horst, as I had to get this project finished, I have removed the module for now so cannot give better info. Will definitely try to do so on a new project though. Thanks again for all your hard work! 1
videokid Posted February 20, 2015 Posted February 20, 2015 Acutally it's an upgrade from 2.5.6 to 2.5.19 because I wanted to use Croppable Image. Deleted index.php and wire folder --> replaced them with 2.5.19 dev In my config there are no imageSizerOptions, so for this purpose I've added it. 'forceNew' => true ---> resulted in your suggestion: forceNew is on 'forceNew'=> false ---> forceNew is off Even with 'off', thumbnails are being regenerated on front-end... [didn't check back-end]
horst Posted February 20, 2015 Author Posted February 20, 2015 what is the name of your imagefield? does it contain mixed chars, I mean upper and lower case? If so, can you try it with a fieldname that only has lowercase chars? As I said above for me the caching works as expected with PW 2.5.19
Pierre-Luc Posted February 21, 2015 Posted February 21, 2015 Hey, would gladly help on that one, but the bug tracker is empty so no idea what to fix/improve/implement. Too soon?
videokid Posted February 21, 2015 Posted February 21, 2015 The name of my imagefield is 'images', I never use upper case, all my fields [regardless type] are lower case. I remember I had a similar set-up with following specs: PW 2.5.18 FieldtypeCroppableImage 0.8.2 InputfieldCroppableImage 0.8.2 ProcessCroppableImage 0.8.4 Guess what, the problem isn't there... Maybe tomorrow or somewhere soon I'll upgrade this one to 2.5.19 see what that gives... Or if you suggest something else? Other set-up PW 2.5.19 FieldtypeCroppableImage 0.8.3 InputfieldCroppableImage 0.8.3 ProcessCroppableImage 0.8.4 Maybe this gives you some insights...
GuruMeditation Posted February 23, 2015 Posted February 23, 2015 How exactly do you go about looping through thumbnails? I have an image field called f_multi_image which allows multiple image attachments. I would have thought it was something like this, but obviously it's not right. $gallery = $page->f_multi_image->getCrop('gallery'); foreach($gallery as $image){ echo "<img src='{$image->url}' alt='{$image->description}' />"; }
videokid Posted February 23, 2015 Posted February 23, 2015 Try this: $gallery = $page->f_multi_image; foreach($gallery as $image){ echo "<img src='{$image->getCrop('gallery')->url}' alt='{$image->description}' />"; } 3
videokid Posted February 24, 2015 Posted February 24, 2015 No Prob, you're welcome... @Horst Could it be the folders .PagefilesManagerxxx aren't been removed in ./site/assets/cache/WireTempDir/ and PW 2.5.19? Not tested extensively, something my eye caught
horst Posted February 24, 2015 Author Posted February 24, 2015 I don't know what .PagefilesManagerxxx is. CroppableImages doesn't use it or interacts with it. ImageSizer also don't. I think it stays there from a upgrade or something? It is preceded by a dot, what is a sign that it isn't read from any PW object. It is a backup directory. (That's all I can think of)
Soma Posted February 26, 2015 Posted February 26, 2015 In new PW dev the croppable image has broken layout when uploading image. After saving the layout seems ok. The new image edit function isn't there as there seems to be some rewrite of markup. Could this be possible to have it working together?
LostKobrakai Posted February 26, 2015 Posted February 26, 2015 The new image edit function isn't there as there seems to be some rewrite of markup. Could this be possible to have it working together? I could imagine the module hooking into the new "variations" modal window or a own dedicated modal like the core one. I never really liked the fact, that the imagefields presentation was changed. With Thumbnails I had breaking admin theme styles and now it's a new core function made unavailable. Additionally, it would be nice if CroppableImage could also recrop api generated crops from the variations modal. Of course only the ones restricted in height and width.
Peter Knight Posted April 19, 2015 Posted April 19, 2015 Is this the proper way to call a crop called Staff-Photo in a field called Images? <?php $peoples = $pages->find ("template=team-detail"); foreach ($peoples as $person){ echo"<a href='{$person->url}'><img src='{$person->Images->getCrop('Staff-Photo')}\'></a>"; } ?> I'm getting an error as follows. Error: Exception: Method Pageimages::getCrop does not exist or is not callable in this context (in /Users/peterknight/Sites/Eden/wire/core/Wire.php line 326)#0 /Users/peterknight/Sites/Eden/site/templates/team-overview.php(50): Wire->__call('getCrop', Array) I'm not sure if it's my syntax or a problem with my install. Croppable Image is installed properly and the pages I am calling in my selector all have an image with Staff-Photo crop applied.
videokid Posted April 19, 2015 Posted April 19, 2015 Your images field in the template 'team-detail' is probably not limited to '1', so I guess in this case you might try echo '<a href="'.$person->url.'" title="'.$person->title.'"><img src="'.$person->Images->first->getCrop('Staff-Photo')->url.'" alt="'.$person->title.'" /></a>';
Peter Knight Posted April 19, 2015 Posted April 19, 2015 @videokid I didn't think this mattered as you can only have one instance of a crop on any one Images field. Sure, you can have many differently sized crops but you can only cropped image based on the Staff-Crop setting? Clearly I was wrong as your code works (thanks) although I modified it slightly yo my own requirements <?php echo"<div class='row'>"; $peoples = $pages->find ("template=team-detail"); foreach ($peoples as $person){ echo"<div class='small-6 medium-4 columns'>"; echo" <div class='person-wrapper grid'> <div class='service-img'> <a href='{$person->url}'> <img src='{$person->Images->first->getCrop('Staff-Photo')->url}'> </a> </div> <strong>{$person->title}, {$person->Qualification}</strong><br/> {$person->Role} </div>"; echo"</div>"; } echo"</div>"; ?>
videokid Posted April 19, 2015 Posted April 19, 2015 Great to read it works! Although I'm not really sure if I understand what you exactly mean here... Modify away!
noodles Posted April 21, 2015 Posted April 21, 2015 Hi Peter, thanks for reporting that. I have looked into that, but it seems it is related to PW core, not croppableimages fields in special, or maybe I have to transform the fieldname to lowercase at some point in the modules code. I have created a new field of type text and given it a capitalized name: My_New_Field The table was created as: field_my_new_field In the fields table it is registered with name = My_New_Field I will further test it with core images field and others and look how it is handled there. So, when creating a new field you can read in the description of the Name* input: But one can enter uppercase letters. Is this intended or should it be sanitized by PW to a-z_0-9 ? Hey Horst, I tried to save my thumbnail settings and got this error: Session: Table 'xxx.field_sliderImage' doesn't exist SELECT pages_id,count(pages_id) FROM field_sliderImage GROUP BY pages_id ORDER BY pages_id So I looked into your code and found this one in FieldtypeCroppableImage.module:339: $TABLE = 'field_' . $field->name; // TODO: name to lowercase To answer your question: Probably. Currently working with a hoster who's obviously case sensitive. I saw the table name was field_sliderimage (all lowercase) and edited your code to this: $TABLE = 'field_' . strtolower($field->name); // TODO: name to lowercase N: Yes! ;-) And yep, it worked! noodles 1
horst Posted April 21, 2015 Author Posted April 21, 2015 Hey @noodles, many thanks for sharing. I go ahead and change this in the repo.
Peter Knight Posted April 21, 2015 Posted April 21, 2015 Great to read it works! Although I'm not really sure if I understand what you exactly mean here... Modify away! What I mean is (and this might be a bug).... An image field of mine has several images. Unless I crop the very first image in the image field, the selector won't work. I like to let my editor choose which image to crop. That image could be the second or third image. With this ... <img src='{$person->Images->first->getCrop('Staff-Photo')->url}'> there seems to be a quirk where PW isn't looking for the very first instance of 'Staff Photo'. It's looking for the very first image. If that image has no cop applied, I get an error. The alternative it to setup a special image field solely for each crop but that shouldn't be necessary ?
videokid Posted April 21, 2015 Posted April 21, 2015 Your explanation makes no sense to me actually ... :-/ Probably I'm not getting what exactly you're trying to achieve... On top, AFAIK, every image is cropped when using CroppableImage, unless I'm really wrong here... if not using 'first' or eq($n), then I guess you use foreach($person->Images as $img) <img src='{$img->getCrop('Staff-Photo')->url}'> but then you'll get all of them.... and the cropped version...
Neeks Posted April 23, 2015 Posted April 23, 2015 is it possible to select the cropped images from my CKeditor image select popup? I if I was going to try to implement it the correct module might be: /wire/modules/Process/ProcessPageEditImageSelect/ProcessPageEditImageSelect.module. Would copying that to /site/modules/, and modifying it be the sensible way to allow cropped images to be selected from CKeditor? Or is there already a setting that already exists for showing more images than just the original (uncroped images) in CKeditor?
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