justb3a Posted October 11, 2014 Posted October 11, 2014 This module is obsolete and will not be developed any further. Please use the ImageExtra Module instead. Overview This module allows you to add additional informations to an image (for example: title, description, link, orientation and any field you may need). If you want to, you can install FieldtypeImageExtraLanguage to get multi-language support. For more informations have a look at the readme. Installation 1a. Clone the module and place FieldtypeImageExtra in your site/modules/ directory. [OR] 1b. Download and unzip it from the module page. git clone https://github.com/justonestep/processwire-fieldtypeimageextra.git your/path/site/modules/FieldtypeImageExtra 2. Login to ProcessWire admin and click Modules. 3. Click "Check for new modules". 4. Click "install" next to the new FieldtypeImageExtra module. If you need multi-language support, you have to install the FieldtypeImageExtraLanguage module. 5. That's all - no settings are required but possible. Define your custom fields 1. Login to ProcessWire admin and click Modules. 2. Open `Images Extra Inputfield` Settings. The following fields are available by default: orientation - image orientation orientation values - values to use as classnames or identifiers for different image orientations title - image title to use for title/alt tag or/and caption, if empty, the content will be generated from the applications filename description - image description link - image link to internal pages If these fields are not enough for you, you can add any other field (for example _author_ and _location_) by writing it (separated by comma) in the field otherField. If you don't need all custom fields, you can easily disable them. One more exception is orientationValues. Here you can insert identifiers for classnames or similar separated by comma. This values will be available in a dropdown list. Usage 1. Under Setup and Fields create a new field using type `ImageExtra` or `ImageExtraLanguage`. 2. After entering the new field name and label, click Save. 3. Configure it depending on your own needs. 4. Save. 5. Add your new field to one or more Templates. Accessing the value This is no different than accessing the value of any other field. $image = $page->image->getRandom(); echo $image->title; echo $pages->get($image->link)->url For use with TemplateTwigReplace {% set image = page.images.getRandom() %} {{image.title}} {{pages.get(image.link).url}} Screenshots Here is a litte example how to access the new fields: // if there are images, lets choose one to output in the sidebar if (count($page->images)) { // if the page has images on it, grab one of them randomly... $image = $page->images->getRandom(); // resize it to 400 pixels wide $image = $image->width(400); // output the image at the top of the sidebar $sidebar = "<img src='$image->url' alt='$image->description' />" . "<h3>$image->title</h3>" . "<blockquote>$image->description</blockquote>" . "<p>$image->author ($image->location)</p>" . $page->sidebar; } 18
kongondo Posted October 11, 2014 Posted October 11, 2014 (edited) Hey @justb3a, Welcome to the forums! Awesome first post! Thanks Edit: Tested this. Works like a charm! Edited October 11, 2014 by kongondo
Noboru Posted October 12, 2014 Posted October 12, 2014 Hi @justb3a, this is exactly what I need to start a artist-website for a friend! Greetings from Südvorstadt!
jacmaes Posted October 13, 2014 Posted October 13, 2014 Wow, just what the doctor ordered for a friend of mine who's a photographer. Thanks!!
thistimj Posted November 15, 2014 Posted November 15, 2014 This module looks great, however, I am having a bit of trouble getting it to display the image I upload. I set everything up, upload an image, and the progress bar stops at 100% without going further and showing the image as usual. When I refresh the page in the admin, there is no image associated with the image field. I checked the assets folder, and the image is getting uploaded to the proper folder, but it's not showing up on the page. I am using PW version 5.2.3.
justb3a Posted November 16, 2014 Author Posted November 16, 2014 @thistimj: I just added some fields to store additional informations. Have you already looked into the log files? Please paste the message if there is one. Did you try to use the "normal" image field, does this work as expected? Maybe it's an ImageMagick issue but I'm not sure if it depends on that...
thistimj Posted November 17, 2014 Posted November 17, 2014 The regular image field works as expected, which is why I am a bit confused as to why Image Extra wouldn't work. What log files are you referring to?Here is a screenshot of what I'm getting. The field above is a normal image field; you can see part of the image.
justb3a Posted November 17, 2014 Author Posted November 17, 2014 Please... watch the request (using proxy / charles, fiddler or network console) check sites/assets/logs/errors.txt check your server log files check output in Console (Browser) I can't reproduce this error. Any error message would be very helpful
thistimj Posted November 18, 2014 Posted November 18, 2014 It ended being some weirdness caused by the Language support module. I had to uninstall that module, reinstall it, and your module started working. Very weird. Thank you for taking the time to help out. I'm looking forward to using your module.
reems Posted December 20, 2014 Posted December 20, 2014 (edited) Hi, I have a strange issue. I use the ImageExtraLanguage Field in different templates on different pages. In the admin the images can be dragged to sort. But on one page the new order is saved correctly, but on another page not. After saving that page, the images are reloaded in the original order. I have no idea what causes this behavior. Only thing is that on the page where the order is not saved, there are more then 100 images, on the other pages where the new order is saved correctly the number of images is max 15. But I can't imagine that this is realy the cause. Thanks. Edited December 20, 2014 by kongondo Reems, I'm moving this to the correct forum...
interrobang Posted December 21, 2014 Posted December 21, 2014 @reems This sounds similar to a issue I had recently https://processwire.com/talk/topic/8345-deleting-large-number-of-images-silently-fails/ In my case increasing max_input_vars in my php.ini solved the problem. 2
Joss Posted January 5, 2015 Posted January 5, 2015 Just trying this out without any language stuff. As soon as I add anything to otherField I get: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_imageextra.location' in 'field list' What am I doing wrong? This is with the latest dev.
justb3a Posted January 7, 2015 Author Posted January 7, 2015 @reems Did interrobangs solution solve your problem? @Joss Try to reassign the Fieldtype ImageExtra. I assumed that you first enter your module config and then add the Fieldtype. The other sequence does not work atm (I have this as a bug on my whiteboard ). The new database columns will be inserted only by FieldType switching.
Joss Posted January 7, 2015 Posted January 7, 2015 Okay, half worked. I had just one custom field of "location" - switched and that was fine. I then created changed the config adding a couple more customs "location, type, date" Created a new field and then switched type. Confirming the switch it said: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'type' doesn't exist in table
adrian Posted January 22, 2015 Posted January 22, 2015 Thanks for this - looks like it has great potential, but at the moment, you have these errors: Warning: stripos() expects parameter 1 to be string, array given in /site/modules/FieldtypeImageExtra/FieldtypeImageExtra.module on line 229|230|231 which break the image upload due to outputting header content before the image during the ajax upload with PW debug set to true. There are also some layout issues if you disable the orientationField - the Link field only takes up half the page width. I had the same issues as Joss, but switching the field type did the trick!
justb3a Posted February 9, 2015 Author Posted February 9, 2015 I developed a new module ImageExtra which allows you to combine custom fields and image cropping (for example). Please have a look at this forum post. This module will not be developed any further. Be careful: if you decide to use ImageExtra with an existing site you'll have to start from scratch. So please make sure to backup your data - just in case you need to go back -, because the old settings are not compatible with the new module's format. 3
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