-
Posts
372 -
Joined
-
Last visited
-
Days Won
4
Everything posted by gornycreative
-
I tried to apply the setPageName() magepage method in a custom page class - the field saves and updates but seems to force the page to an unpublished state. Trying to publish the page has no effect. I can use other updating methods - for example, setting the title field value in onSaveReady() - and it saves and leaves the status, but perhaps there is something special happening because of the name field getting saved? This is using v3.29.0 of RockMigrations and PW 3.0.224
-
I'm guessing this is the intended behavior, so this might be a feature request more than a bug. I ran into an issue with a module where there was an asmselect inputfield that I was trying to add additional options to and they kept reverting. What was odd to me was that I don't believe any migrations were actually running, but the options array that I had included in the installModule call kept returning and overwriting my changes. The watched file containing the module installation calls had not triggered as far as I can see in the logs, but the options array values kept overriding my attempts to expand the selections. (It says the file was skipped). Is there a way to set the options for a module on installation so that you can choose between setting a locked-in configuration or just setting default/initial settings for the module? EDIT - I realized that the reason the installModule was installing the options repeatedly was because I placed the install in the init() for a custom page class. I should move it to the migrate() at least or perhaps put additional checks in place to determine if it is necessary to populate an options array.
-
[solved] Tracy Console almost unusably slow
gornycreative replied to bernhard's topic in Tracy Debugger
Testing in the latest Firefox on windows 10, I get no lag at all. Although I do get a weird cursor line flicker - not sure that is normal - that follows from the top left of the window corresponding to the cursor editing area in the panel. I'm guessing there is a bit of memory/interference being caused by the new security features in chromium-based browsers. This include at least Chrome and Brave browser - haven't tried Bing yet. -
Nice I'm guessing this is how we could use the addFunction method also?
-
[solved] Tracy Console almost unusably slow
gornycreative replied to bernhard's topic in Tracy Debugger
Here's my panel list - maybe we've got a common panel causing realtime lag? Are you using UserActivity? -
[solved] Tracy Console almost unusably slow
gornycreative replied to bernhard's topic in Tracy Debugger
I thought I was the only one. Keyboard lag is brutal with the latest chrome. I figured it was chrome's new inbuilt 'privacy protection' spy features. -
So I can get calculations on images in combo fields on the fly, I'm having trouble saving the data back into filedata - still waiting to hear back from someone who is better with Combo to help there. I've tried a lot of different methods but it looks like there are extra hooks tied to the combo that throw errors similar to what you were seeing. I can put out a version without the caching feature for combo fields if folks want it - I would just recommend being relaxed with the quality because you will be doing real-time calcs each time. Regular image fields are not affected by any of this.
-
I didn't realize there are technically two pages created in the back end for search and both of them are hidden and have system ids - 300 and 1000, There's a search page under root '/' that's id 1000 and a search page under /*adminhome*/page/ that is id 300 - for admin search. When I used the name selector by itself in the Tracy console before it grabbed the admin search page but later when I used the template selector it grabbed the public search page. The public facing search page applied the custom SearchPage page class. I'm in business. id=300, name=search, template=admin, = the backend search page/process id=1000, name=search, template=search = the frontend search page/process - and the custom page class gets applied to this page.
-
Looking into it more, I have come to the conclusion that the Search page uses the admin template and as a result falls outside the public facing page class framework. Even though the output from the controller/view is a ProcessWire/Page class, there is no way to extend the pageclass because it is the Process that dominates the function of the page. If I wanted to modify the Search workflow I could hook into it, but because I actually want to grab url segments and run some query magic to convert them into a complex query to pass to search, I think I will need to set up a unique page and pageclass to do that. Hopefully someone with more knowledge of the admin side can chime in.
-
I noticed the search template and search page do not seem to be alterable by defining a custom page class. If I try creating a page class file where class SearchPage extends Page { it does not appear to effect the Search page class at all - the page still appears as ProcessWire/Page and none of the public functions I define can be used. Is this a feature of having a page that uses a Process or is it because it is a system file, or is there a different class it should extend?
-
Hello, I was originally going to include this as part of my forthcoming AdminStyleChroma module but decided to roll it out as its own module. https://github.com/solonmedia/ImageColorThief Please check out the readme for a deeper explanation - but the short version here for now: This module adds two new methods to the Pageimage class, allowing you to extract the main dominant color or a palette of prevalent colors from an image. You can use the entire image to evaluate color dominance, or you can use a select swatch from the image based on inset rectangles from the edges, blocks at each corner, or a swatch centered on the focus point if you choose to use it. You can also select the granularity of the quantization to get more accurate color results. This is not an eyedropper algorithm - the colors are close approximates. Great if you have color schemes you'd like to coordinate with the headliner or seasonal images, or if you'd like to be able to sort a gallery of images by dominant color, etc. Looks real nice, for example if you are running a ken burns style image fade background and the images are sorted by a channel, etc. How to sort them? Ugh that's something I haven't tackled - yet: https://www.alanzucconi.com/2015/09/30/colour-sorting/ It works on JPG, GIF, PNG and WEBP images. It outputs RGB, HEX, RGB Integer, raw Array with R, G, B elements or an object. Once I've got myself registered and whatnot I'll submit it to the Modules Directory. Installs from zip for now: https://github.com/solonmedia/ImageColorThief/archive/refs/heads/main.zip I'd consider it Beta - the underlying libraries are pretty stable but I'd like to run a few more tests on input. Let me know if you have any questions/thoughts.
- 9 replies
-
- 18
-
Okay I think I found a way - it is circuitous but it seems to work, so I will post it for posterity in case anyone else is trying to mess around with saving similar data in this way... //This is for use INSIDE a method being added via Pageimage::addHookMethod but Pagefile should work in a similar manner //Grab the event object. $f_pageImage = $event->object; //Grab the page the event object lives on. $page = $f_pageImage->page; //Grab the unformatted version of the pageimages array the event object lives in from the field $u_Images = $page->getUnformatted($f_pageImage->field->name); //Grab the file inside the unformatted field content array that has the same filename as the original file objects filename $pageImage = $u_Images->getFile($f_pageImage->basename);
-
I am close to releasing a module that adds hook methods to Pageimage that will calculate the main color and/or a palette of dominant colors in an image. I've been looking at different options to store/cache this value based on a comparison of the options array used to grab the first calculation, because with some image sizes and precision factors and the number of images the calculation lags more than you would want on a front-facing site. If the data exisits, use it unless the options array passed along is different than the one stored - in which case recalculate. My initial thought was to store them in the filedata array for the given file, and I can get/pull the item but I cannot save the Pageimage filedata within the hook because the hook runs regardless of whether or not you get the initial images in a formatted or unformatted state. I can grab the data and save it outside the hook method like so: $page = $this->wire->pages->get('name=about'); $images = $page->getUnformatted('images'); foreach($images as $image) { $palette = $image->palette(); $maincolor = $image->maincolor(); $image->save(); } But this makes the process more cumbersome for developers. I'd rather have the hook method somehow be able to grab the unformatted version of the Pageimage from the Pageimages returned by the 'images' field, merge the filedata colors into the filedata array and save it. The problem is I can't see how to query an individual image/file within that Pageimages/Pagefiles array.
-
I believe what you are looking for is ImportExternalImages - which was designed to allow a user to cut and paste a blog article from another platform like Blogger into a specified text area and then have PW bring in the assets from the URLs that were pasted into a field you set up in config. https://processwire.com/modules/import-external-images/
-
I tried turning on tags for an image field using the following config: 'detailed_images' => [ 'label' => 'Detailed Images', 'flags' => 0, 'type' => 'FieldtypeImage', 'icon' => 'picture-o', 'fileSchema' => 271, 'maxFiles' => 0, 'textformatters' => [ 0 => 'TextformatterEntities', ], 'extensions' => 'gif jpg jpeg png', 'outputFormat' => 0, 'descriptionRows' => 5, 'useTags' => 1, 'gridMode' => 'left', 'focusMode' => 'zoom', 'clientQuality' => 90, 'inputfieldClass' => 'InputfieldImage', 'unzip' => 1, 'tags' => 'content_components', 'collapsed' => 0, 'columnWidth' => 100, ], But when I try to edit a page that has the field in the template I get a SQL error: 'field_detailed_image.tags' column not found in 'field_list'. I tried looking deeper into the methods and thought perhaps calling getDatabaseSchema would call the private updateDatabaseSchema but it seems like that doesn't work. I have turned off useTags in the meantime but I'm guessing this affects any fieldtype that extends fieldtypeFile.
-
I'm afraid I have listened to this loop way too much since I discovered their long-form channel.
-
Getting an array export of default Fieldtype settings?
gornycreative replied to gornycreative's topic in API & Templates
Exactly why I asked. And there is a potential solution actually and I found it and started working on some things and forgot to come back to this. The getTableData() function for fields seems to pull just the configured settings in the database table. getExportData actually uses the data from the getTableData call and merges it. It's in wire/core/Field.php