Jump to content

Solved: Image field on user template seems to switch from single file to array, outputformating always true


Recommended Posts

I have a single image field on the user template displaying an profile image in the page header. Strange thing is that on some request the field behaves as expected but on some requests it behaves like outputformaing is false (like an array). I cant seem to find any code that would turn off the outputformating so i'm a bit baffled with what's going on (most likely something i'm doing wrong).

I'm using @teppo's wireframe, latest PW dev on the site. 

Update: I commented out this: 

$createdBy = $users->get("id={$fil->fil->created_users_id}");

and the user image rendered as expected. 

My guess is that i get a new user without the image and that causes the error.
But how can i get one or more users without replacing the current one? 

I changed the image field settings to maximum allowed files to 1 and formatted value to automatic. Now the previous page renders as expected but other pages containing the image field gets the following error: 


User Error

Exception: Method Pageimages::size does not exist or is not callable in this context (in /home/mysite.com/wire/core/Wire.php line 563)

#0 /home/mysite.com/wire/core/WireArray.php(2457): ProcessWire\Wire->___callUnknown('size', Array)
#1 /home/mysite.com/wire/core/Wire.php(419): ProcessWire\WireArray->___callUnknown('size', Array)
#2 /home/mysite.com/wire/core/WireHooks.php(968): ProcessWire\Wire->_callMethod('___callUnknown', Array)
#3 /home/mysite.com/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pageimages), 'callUnknown', Array)
#4 /home/mysite.com/wire/core/Wire.php(487): ProcessWire\Wire->__call('callUnknown', Array)
#5 /home/mysite.com/site/templates/partials/navdesktop.php(24): ProcessWire\Wire->__call('size', Array)
#6 /home/mysite.com/site/templates/layouts/default.php(41): include('/home/mysite/...')
#7 /home/mysite.com/wire/core/TemplateFile.php(328): require('/home/mysite/...')
#8 /home/mysite.com/site/modules/Wireframe/lib/View.php(84): ProcessWire\TemplateFile->___render()
#9 /home/mysite.com/wire/core/Wire.php(413): Wireframe\View->___render()
#10 /home/mysite.com/wire/core/WireHooks.php(968): ProcessWire\Wire->_callMethod('___render', Array)
#11 /home/mysite.com/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(Wireframe\View), 'render', Array)
#12 /home/mysite.com/site/modules/Wireframe/Wireframe.module.php(843): ProcessWire\Wire->__call('render', Array)
#13 /home/mysite.com/wire/core/Wire.php(416): ProcessWire\Wireframe->___render(Array)
#14 /home/mysite.com/wire/core/WireHooks.php(968): ProcessWire\Wire->_callMethod('___render', Array)
#15 /home/mysite.com/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Obj … #33 {main}

Update: Setting the user outputformating to true right before rendering the user image fixed it. I guess i have outputformating set to false somewhere but i'm unable to find it.

Link to comment
Share on other sites

  • Mats changed the title to Solved: Image field on user template seems to switch from single file to array, outputformating always true

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...