justb3a Posted February 9, 2015 Share Posted February 9, 2015 Some time ago I developed a module (FieldtypeImageExtra) which extends Fieldtype Image with the ability to add custom fields to an image. This worked well but it had a somehow restricted applicability and did not meet all of our needs. There of course are other useful image modules like CroppableImage or ImageFocusArea, but up to now there was no possibility to combine image cropping with custom fields support. So you had to decide whether to add image cropping or the possibility to add custom fields because each of those modules sets up their own field type (and input type) which cannot be combined. The new module ImageExtra allows you to have both functionalities. You can get the module from GitHub. For more informations have a look at this blog post. If you notice any problems or unexpected behaviour please let me know. 22 Link to comment Share on other sites More sharing options...
kongondo Posted February 9, 2015 Share Posted February 9, 2015 Seems like my wish came true...even without formally requesting it I agree this is the way to go. Good job! 1 Link to comment Share on other sites More sharing options...
justb3a Posted February 10, 2015 Author Share Posted February 10, 2015 oh, I didn't notice that topic, I would have responded as well. Maybe it's a good idea to add an external url field. What do you think? 2 Link to comment Share on other sites More sharing options...
horst Posted February 10, 2015 Share Posted February 10, 2015 Hey Bea, this is so cool! You have released it! The Blog Post is nice too. Link to comment Share on other sites More sharing options...
kongondo Posted February 10, 2015 Share Posted February 10, 2015 oh, I didn't notice that topic, I would have responded as well. Maybe it's a good idea to add an external url field. What do you think? If it will be able to handle a URL field well, then maybe there is no need. On the other hand, since you already a internal links feature, maybe good to add an external one too...Anyway, its a 50/50 thing...so your call Link to comment Share on other sites More sharing options...
titanium Posted February 11, 2015 Share Posted February 11, 2015 Thanks for this module, justb3a, it comes right just in time for me However, I think there is a problem: I noticed that values for "caption", orientation or custom fields are saved in database (that part works). But if I edit the same image again, the values have disappeared. The fields are empty. If the image is saved again, the values in the database get lost. UPDATE: I tried to debug it. If I change line 1045: $value = $this->wire('sanitizer')->entities($pagefile->{$current}($language)); to $value = $this->wire('sanitizer')->entities($pagefile->{$current}); the problem disappears. I guess this fix does not work if you have more than one language defined. Link to comment Share on other sites More sharing options...
justb3a Posted February 11, 2015 Author Share Posted February 11, 2015 @titanium: First of all thanks for testing and feedback I cannot reproduce this behavior. Could you please provide me more informations: ProcessWire Version Number of max allowed files Overwrite existing files? Do you just change meta informations or upload a new image? Do you use ImageExtra in combination with any other Image Module? (Please tell me which one) I installed a fresh ProcessWire installation, Beginner Package (just one language), and it works without any problems. EDIT: I still cannot reproduce this behavior but I changed this line to: $value = $this->wire('sanitizer')->entities($language ? $pagefile->{$current}($language) : $pagefile->{$current}); I hope it works now. Link to comment Share on other sites More sharing options...
adrian Posted February 20, 2015 Share Posted February 20, 2015 On one of my PW sites it works fine, but on another one, if I try to edit a page with an image, I get this error: Error: Using $this when not in object context (line 213 of /home/path/site/modules/ImageExtra/ImageExtra.module) Both site are using the same versions of Image Extra and PW (both the very latest). Link to comment Share on other sites More sharing options...
justb3a Posted February 20, 2015 Author Share Posted February 20, 2015 In line :213 the method for the image link is added. The other methods seems to work because the method for the link is called as the last one. Did you check the Add internal link field box? Uploading an image wasn't a problem? Did you add an image link? Does this error occurs on every page which contain this field? Link to comment Share on other sites More sharing options...
adrian Posted February 20, 2015 Share Posted February 20, 2015 Yep, I checked add internal link field box. The image uploads fine, and i can add a link, but it doesn't matter whether I actually add the link or not, I still get that error and the only way to get it to go away is to remove the field from the template, or uncheck internal link field box for the field. It seems to occur with every page containing the field. The only thing I can think of that might be making it work on one server vs the other is php version: 5.6.4 works, but 5.4.33 5.3.29 doesn't. Link to comment Share on other sites More sharing options...
justb3a Posted February 20, 2015 Author Share Posted February 20, 2015 That sounds reasonable and could explain other issues I couldn't reproduce. I've tested only with PHP version 5.5.18. I try to take some time next week to install version 5.3.8 (ProcessWire requires at least this version) and test all again. jeah... 1 Link to comment Share on other sites More sharing options...
adrian Posted February 20, 2015 Share Posted February 20, 2015 Sorry for the confusion - I was looking at the wrong server. The server in question is running 5.3.29 so it's simply an issue with using $this in the anonymous functions (not allowed in 5.3) you are using, so should be an easy fix. 1 Link to comment Share on other sites More sharing options...
justb3a Posted February 20, 2015 Author Share Posted February 20, 2015 Feel free to provide a solution here oder create a pull request. Otherwise I will look at this next week... 1 Link to comment Share on other sites More sharing options...
adrian Posted February 21, 2015 Share Posted February 21, 2015 Feel free to provide a solution here oder create a pull request. Otherwise I will look at this next week... PR has been submitted to fix those fatal errors in PHP 5.3. The other relatively minor (but niggly) thing is that the description field is not getting the InputfieldMaxWidth class applied to it and as a result, the input is very narrow. I took a quick look at the regex stuff you have going on in regard to this, but figured it was easier for you to figure out the issue with this because I haven't really figured out why you are replacing the label class and label for description, although I am sure there is good reason 2 Link to comment Share on other sites More sharing options...
justb3a Posted February 21, 2015 Author Share Posted February 21, 2015 Thanks for the pull request. The other relatively minor (but niggly) thing is that the description field is not getting the InputfieldMaxWidth class applied to it and as a result, the input is very narrow. I took a quick look at the regex stuff you have going on in regard to this, but figured it was easier for you to figure out the issue with this because I haven't really figured out why you are replacing the label class and label for description, although I am sure there is good reason If you have multi language support activated there is no label for the description field (but I want to have one) and I want to add some padding. So I check whether it's a multi language installation - but one line didn't make it into the right area. It's corrected Default: missing label and padding for description 2 Link to comment Share on other sites More sharing options...
biber Posted April 29, 2015 Share Posted April 29, 2015 (edited) Hi, I have built a gallery site and use ImageExtra to add some additional informations to the images. Everything works fine if I visit the page as a logged-in user, but if I have a look at the site as a (normal) guest, none of the extra fields are displayed. I think this is a problem of missing access rights, but I did not find any point where to change it. The rights of the files on the server seem to be OK. Any ideas? Thanks Günter Edited April 30, 2015 by LostKobrakai Merged with module support topic Link to comment Share on other sites More sharing options...
formmailer Posted April 29, 2015 Share Posted April 29, 2015 Hi! A great module, but I am wondering if it is possible to use html (or markdown) in the extra fields? I tried this, but without luck. But I might have missed something. /Jasper Link to comment Share on other sites More sharing options...
justb3a Posted April 30, 2015 Author Share Posted April 30, 2015 (edited) @biber Hi, just to make sure: you visit the page in the frontend? That means you do not see the text output if you are not logged in. Strange. Do you see the images? Or is everything missing? Could you (temporary) try to disable the module and use the built-in functionality including description. Just to make sure it depends on the module. Edited April 30, 2015 by LostKobrakai Added @… to make the response clear after merging topics Link to comment Share on other sites More sharing options...
justb3a Posted April 30, 2015 Author Share Posted April 30, 2015 @formmailer: You do not missed something. It's not possible at the moment. I could imagine to add a checkbox in the module setting to enable markdown. Could you open an issue on github or send me a pull request? I've no time at the moment to implement this. Thanks. Link to comment Share on other sites More sharing options...
biber Posted April 30, 2015 Share Posted April 30, 2015 Hi, thanks for your reply. Yes, it's right: I visit the page in the frontend. If nobody is logged in I can see the image and the 'description'-field, if I log in I can see the rest of the fields. I had a look at my database with phpMyAdmin, where I can find the table 'field_images' with all the fields and it looks OK. btw. Is there a possibility to change the order of the fields of the admin page (caption before description) and/or change the label of the fields at the admin page in dependence of the page. For example: page 'Menschen': field_1 labelled 'Vorname', field_2 labelled 'Nachname' - page 'Pflanzen': field_1 labelled 'deutscher Name', field_2 labelled 'botanischer Name'. This should make it easier for users to add new pictures. Link to comment Share on other sites More sharing options...
formmailer Posted May 4, 2015 Share Posted May 4, 2015 @formmailer: You do not missed something. It's not possible at the moment. I could imagine to add a checkbox in the module setting to enable markdown. Could you open an issue on github or send me a pull request? I've no time at the moment to implement this. Thanks. Hi! Thank you for your reply! I'll open en issue on Github. If I have time to fix it myself, I'll send you a pull request. //Jasper Link to comment Share on other sites More sharing options...
biber Posted May 13, 2015 Share Posted May 13, 2015 Hi, thanks for your reply. Yes, it's right: I visit the page in the frontend. If nobody is logged in I can see the image and the 'description'-field, if I log in I can see the rest of the fields. I had a look at my database with phpMyAdmin, where I can find the table 'field_images' with all the fields and it looks OK. btw. Is there a possibility to change the order of the fields of the admin page (caption before description) and/or change the label of the fields at the admin page in dependence of the page. For example: page 'Menschen': field_1 labelled 'Vorname', field_2 labelled 'Nachname' - page 'Pflanzen': field_1 labelled 'deutscher Name', field_2 labelled 'botanischer Name'. This should make it easier for users to add new pictures. Hi, I found the solution for my problem by myself: I filled out the german sections of the fields and didn't realize that guests see the default (english) version. A simple click on >Admin >Access >Users >guest >Language >deutsch brought back my vanished items. Still remains my whish to change the order of the fields and to rename them at the admin page. Thanks Günter Link to comment Share on other sites More sharing options...
justb3a Posted May 19, 2015 Author Share Posted May 19, 2015 Sorry I don't have time at the moment to implement this. For translating the strings there is already an issue opened on github. For me it isn't necessary to change the order of the fields. Try to leave the checkboxes blank and add caption (for example) in other fields. I know there is a hint Do not use `orientation`, `link` or `caption` in this list. I just tested it and it seems to work. I know this solves not the problem to rearrange link and orientation field. You can also open an issue on github (or solve it on your own and send me a pull request ). Link to comment Share on other sites More sharing options...
biber Posted May 19, 2015 Share Posted May 19, 2015 @ justb3a: Thanks for your reply. After I have found my mistake your module works fine for me. The other wishes are luxury problems and I have a lot to learn before I try to solve it on my own. Günter Link to comment Share on other sites More sharing options...
tekno Posted July 8, 2015 Share Posted July 8, 2015 hi thats awesome module. good job. i want to know how i print the images orientation values? 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