Guy Verville Posted March 9, 2014 Share Posted March 9, 2014 I have set an image field to appear only if another field is checked. This works perfectly. However, when I try to upload an image into that field (image type), nothing happens. There is already another image field in the template. I click the field Vedette The image field appears. I select a file. There is no restriction for the size but it is very small. Processwire seems to process the file. Then nada... I did try to upload the same file in the regular image field, and it works perfectly. Any idea? Link to comment Share on other sites More sharing options...
apeisa Posted March 9, 2014 Share Posted March 9, 2014 What are responses from the image processing? You can see those from your browsers debug tools, network tab (or console in case of error). Link to comment Share on other sites More sharing options...
Guy Verville Posted March 9, 2014 Author Share Posted March 9, 2014 I have noticed no error but will check again. Note that removing the dependency of the field vedette resolves the issue, but the dependency is gone. Link to comment Share on other sites More sharing options...
apeisa Posted March 9, 2014 Share Posted March 9, 2014 Does it work if you check the vedette field, save and then upload file after page save (when image field is already visible)? Link to comment Share on other sites More sharing options...
Guy Verville Posted March 9, 2014 Author Share Posted March 9, 2014 No. I reenabled the dependency (vedette=1), the problem was there. Disabled it, problem gone. Link to comment Share on other sites More sharing options...
Guy Verville Posted March 9, 2014 Author Share Posted March 9, 2014 And this image field does not appear to be sizable by the ->size method... I get this error: 2014-03-09 12:33:24 admin http://dev.creacc.org/ Error: Exception: Method Pageimages::size does not exist or is not callable in this context (in /home/creaccor/public_html/dev/wire/core/Wire.php line 320) #0 /home/creaccor/public_html/dev/site/templates/accueil.php(16): Wire->__call('size', Array) #1 /home/creaccor/public_html/dev/site/templates/accueil.php(16): Pageimages->size('140px', '85px') #2 /home/creaccor/public_html/dev/wire/core/TemplateFile.php(140): require('/home/creaccor/...') #3 [internal function]: TemplateFile->___render() #4 /home/creaccor/public_html/dev/wire/core/Wire.php(359): call_user_func_array(Array, Array) #5 /home/creaccor/public_html/dev/wire/core/Wire.php(317): Wire->runHooks('render', Array) #6 /home/creaccor/public_html/dev/wire/modules/PageRender.module(337): Wire->__call('render', Array) #7 /home/creaccor/public_html/dev/wire/modules/PageRender.module(337): TemplateFile->render() #8 [internal function]: PageRender->___renderPage(Object(HookEvent)) #9 /home/creaccor/public_html/dev/wire/core/Wire.php(359): call_user_func_array(Arra This is restricted to one occurrence, but I did try to set no limit. Same problem. The code is simple, and works with the regular image. $lesVedettes = $pages->find('vedette=1'); $itemVedette = 0; $miniatures = '<div id="lesMiniatures" class="grid-35 mobile-grid-100 tablet-grid-35"><ul class="ui-tabs-nav">'; $photos = '<div id="lesPhotos" class="grid-65 mobile-grid-100 tablet-grid-65">'; foreach ($lesVedettes as $vedette){ $itemVedette++; $miniatures .= '<li class="ui-tabs-nav-item" id="nav-fragment-'.strval($itemVedette).'">'; $miniatures .= '<a href="#fragment-'.$itemVedette .'">'; $miniatures .= retournerImage($vedette->imagevedette->size('140px','85px')->url); Link to comment Share on other sites More sharing options...
apeisa Posted March 9, 2014 Share Posted March 9, 2014 Error you are getting means you are using size method on Pageimages array, not on single pageimage object. Link to comment Share on other sites More sharing options...
Guy Verville Posted March 9, 2014 Author Share Posted March 9, 2014 Can you elaborate? If I restrict the number of image to 1, I understand it removes the array, but how then to code a resize? Link to comment Share on other sites More sharing options...
Guy Verville Posted March 9, 2014 Author Share Posted March 9, 2014 I have read the document and it doesn't help. My field is called imagevedette (which is of an image type). I have also the regular image field (two purposes here, i must separate those fields for the user). if i call imagevedette->url, I get the path, but no image. Something eludes me here... Further investigation. 1. I have two image fields, one called images and the other one called imagevedette. The former has no restriction, the latter is limited to 1 occurrence. 2. This code : echo $vedette->images->eq(0)->url outputs this: /site/assets/files/1001/montreal_en_rose.png 3. This code : echo $vedette->imagevedette->url outputs this: /site/assets/files/1001/ Perhaps we can't have two image fields in the same template? Link to comment Share on other sites More sharing options...
horst Posted March 10, 2014 Share Posted March 10, 2014 $miniatures .= retournerImage($vedette->imagevedette->size('140px','85px')->url); ... imagevedette->size(140, 85) // integer, not string with px 1 Link to comment Share on other sites More sharing options...
apeisa Posted March 10, 2014 Share Posted March 10, 2014 Also do you have output formatting set to false at some point? It makes single image fields behave as arrays too. if you add the eq(0) to imagevedette field too, the url method will work. There are no restrictions for the amount of image fields in template. Link to comment Share on other sites More sharing options...
Guy Verville Posted March 12, 2014 Author Share Posted March 12, 2014 Hello Horst, I have tried that, and it didn't help. I used a workaround in the meantime, just uploaded the photo and used CSS to resize it. When I will have time, I will try to figure out what's going on. Thanks Apeisa for the input, but I have tried this too. Very strange. Link to comment Share on other sites More sharing options...
MadeMyDay Posted March 12, 2014 Share Posted March 12, 2014 I already reported that somewhere and Ryan said that image fields are not supported (yet). Link to comment Share on other sites More sharing options...
horst Posted March 12, 2014 Share Posted March 12, 2014 @MadeMyDay, @Guy Verville: - http://processwire.com/talk/topic/4323-field-dependencies/page-5#entry45033 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