Orlando Hamsho Posted September 24, 2015 Share Posted September 24, 2015 My question: How do I make a proper Image field in a process module? The situation: I'm making a process Module that requires you to upload an image. The problem: I can't seem to be able to save images through my process Module image Field. To further explain: The loading animation (pink bar filling up to 100%) doesn't trigger. When trying to save the page, I get sent to an error each time (which i've been slowly debugging), current one is: Error: Call to a member function first() on a non-object (line 435 of [path-to-wire-folder]/modules/Inputfield/InputfieldFile/InputfieldFile.module) This error message was shown because you are logged in as a Superuser. Error has been logged. Which currently corresponds to this code segment: //InputfieldFile Module //___processInputAddFile() function if($this->maxFiles == 1 && $total) { $pagefile = $this->value->first(); // This is the line. $description = $pagefile->description; $tags = $pagefile->tags; $rm = true; if($filename == $pagefile->basename) { // use overwrite mode rather than replace mode when single file and same filename if($this->overwrite) $rm = false; } if($rm) { if($this->overwrite) $this->processInputDeleteFile($pagefile); $this->singleFileReplacement = true; } } I also can't seem to find examples of how to do this in the existing modules (The MarkUpSEO one, for example, uses an URL field that it later processes on it's own). My code: // Image Field array( 'name' => 'example_image', // name of field 'type' => 'image', // type of field (any Inputfield module name) 'label' => $this->_('Example Image Field'), // field label 'description' => $this->_('Example Image Field'), 'required' => true, 'maxFiles'=> 1, 'destinationPath' => wire('config')->paths->ProcessExample."assets" ) The destinationPath i'm choosing is a folder named "assets" inside of my own module, but apparently there's something i'm missing to make it work. Thanks in advance for any help you can provide on this topic Link to comment Share on other sites More sharing options...
titanium Posted October 13, 2016 Share Posted October 13, 2016 Sorry for rising this topic from the dead, but I'm facing the same problem currently. I would like to add a custom option to a module, which allows to upload an image. Since a module is not a page, you simply can't bind an image to a module, I guess. Is that assumption right? 1 Link to comment Share on other sites More sharing options...
horst Posted October 13, 2016 Share Posted October 13, 2016 Yes and no. You cannot add it to a module config, but you can create a Processmodule with its own view page. There you can use an imagefield. https://processwire.com/talk/topic/8359-adding-image-or-file-field-to-a-module-configuration/ not full target, but a good starting point 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