Leaderboard
Popular Content
Showing content with the highest reputation on 03/09/2026 in all areas
-
Not really sure this is a tutorial, but if you're struggling with large PNG files, here is a nice little hook to compress them with pngquant. Obviously you need to install pngquant (https://pngquant.org/) first and exec() can't be disabled. $wire->addHookAfter('Pageimage::size', function(HookEvent $event) { $img = $event->return; // the resized Pageimage variation $path = $img->filename; // Only process PNGs if (strtolower(pathinfo($path, PATHINFO_EXTENSION)) !== 'png') return; // Skip if already optimized (optional marker file approach) $marker = $path . '.pngquant'; if (file_exists($marker)) return; // Run pngquant (overwrites in place, quality 65-80) $cmd = sprintf( 'pngquant --quality=65-80 --force --output %s -- %s 2>&1', escapeshellarg($path), escapeshellarg($path) ); exec($cmd, $output, $returnCode); // Mark as optimized so we don't re-process on subsequent calls if ($returnCode === 0 || $returnCode === 99) { // 99 = quality target not met, kept original touch($marker); } });6 points
-
Hi everyone, Well, I finally have a version of Tracy which is ProcessWire namespaced. This has not been easy, although the last issue (which was breaking sites on upgrade from an old non-namespaced version) finally seems to be resolved thanks to some AI help. Unfortunately because this version took so long I lost patience with maintaining separate branches so it also includes a move to IndexedDB instead of LocalStorage for Console data (since I added the multiple tabs if you dumped a lot of content across several tabs it was possible to hit the 5MB LocalStorage limit). It also includes a lot of other random fixes and security improvements (although I think mostly hypothetical given the access restrictions to it). I have also dropped support for PHP < 7.1 (inline with PW). If anyone would be willing to test the upgrade from https://github.com/adrianbj/TracyDebugger/archive/refs/heads/namespaced.zip I'd really appreciate it. Please only test on a dev site and if you do run into any issues, the best way to recover is to delete TracyDebugger folder from /site/modules folder and go back to the admin and reinstall, but hopefully this is no longer a problem. Thanks, Adrian2 points
-
@mattgs Like Adrian, I also consider myself very environmentally conscious. I've not spent much time learning AI in part because I thought it was problematic for a lot of reasons. But I don't think we're likely to stop these AI companies so that's why I thought I should try things out with a company that seems to have more ethics than the others. Anthropic seems to have a mission for AI safety and sustainability. I hope it's legit. And as far as I can tell, the other companies don't, which I find concerning. But I'm also not as up-to-speed as you are on the on the issues you brought up, so I'll have to look closer as well as check out the video you mentioned (do you have a link?). I'm also aware that a project like ProcessWire gets executed millions upon millions of times every month (or day?) throughout the world, and every execution consumes energy. So I've always been very interested in optimization and making ProcessWire use as little time and energy as possible to do its work. The updates that we've been focusing on here are aimed directly at that. So perhaps AI is using a little energy to find optimizations and bugs in PW, but that single brief code review session reduces the energy usage of every ProcessWire execution going forward. This is a case where AI is likely saving a lot more energy than it consumes, indirectly by making ProcessWire use less energy. Some of the optimizations and bugs its found have been there since the beginning, and likely would have never been identified otherwise.2 points
-
This week on the dev branch we've got several commits with various core improvements and fixes. @adrian has been using Claude Code to suggest core optimizations (focused mostly on the PageFinder) and so he sent the suggestions to me. (PageFinder is the brains behind the $pages->find() method, and many others). I took the suggestions and coded them into our PageFinder, but didn't want to mess with what was already working well, so put them in a new class named PageFinder2, at least temporarily. If running the latest dev branch, you can enable PageFinder2 by adding the following to your /site/config.php: $config->PageFinder('version', 2); The most significant changes are: using subqueries for subselectors rather than separate independent queries; Reusing PageFinder instances (keeping a pool of typically 1-3 PageFinders rather than creating a new one for each $pages->find() operation); and lots of in_array() calls have been converted to isset() lookups, which should technically be faster (still the case in PHP8?, I'm not sure). There were some other changes as well. Theoretically these changes should make PageFinder even faster than it already is. I did quite a bit of testing and found that for the most part it performs the same as PageFinder v1. But then I came across a rather complex selector that translated to a much faster PageFinder operation, nearly twice as fast, and that convinced me it was worthwhile. While PageFinder v2 is not consistently faster than v1, there are some situations where it can be a lot faster. I'm not totally clear on what those situations are just yet, but I'll be doing more testing. In other situations it also can use a lot fewer queries, though that doesn't necessarily translate to a performance difference. But on the whole, all of Claude's suggestions were quite good, regardless of performance improvements. I was pretty impressed with what Claude Code had suggested, so decided to install it on my computer too. I've found it's particularly good at finding bugs. I'll ask it to do a code review on a core file, and it always has good suggestions. It uses ProcessWire terminology too. For instance it pointed me to an object that wasn't properly "wired to the ProcessWire instance", and that's something you'd only ever hear in ProcessWire land. Claude code also helped with improvements to our DatabaseQuery* classes, PagesVersions module, Wire base class, NullPage class, and minor updates to the PagesLoader* classes. I'm not having it write any code just yet, but am having it suggest where improvements can be made. I like to code. I asked it how it knew so much about ProcessWire, and it said that it stays up-to-date with the forums, the website, API docs, and GitHub repo. Thanks to @adrian and @Jan V. for recommending it to me (Jan V. uses it to manage this webserver), I can see how it's going to be a big help to ProcessWire with its suggestions and ideas, I'm already learning a lot from it. And if you get a chance to try the updated PageFinder, please let me know how it works for you. Thanks for reading and have a great weekend!1 point
-
Seriously? Is this why you're disappointed with our community? Are you even an adult person? If you're so worried about the environment, you should start by quitting programming yourself, dude. Producing a single new laptop generates approximately 331 kg of CO2 emissions, while desktops create up to 948 kg of CO2. The manufacturing process accounts for 75%-85% of this impact, consuming 1,200 kg of water and 239 kg of fossil fuels. Globally, electronics contribute significantly to 62 million tonnes of annual e-waste. The software industry, part of the broader ICT sector, is responsible for approximately 2% to 4% of global greenhouse gas emissions, a figure comparable to the entire aviation industry. These emissions stem from both the energy consumed during software operation and the "embodied carbon" from manufacturing hardware. Key Environmental Impacts of Laptops, PCs, and Software Development: Carbon Footprint: Manufacturing a new laptop produces over 300kg of CO2 Resource Intensity: Creating one computer requires 1.5 tons of water, 48 pounds of chemicals, and 530 pounds of fossil fuels. E-Waste Generation: Small IT equipment (laptops, phones) generates 11 billion pounds of global e-waste annually. Toxicity: Improperly discarded computers leak toxic heavy metals, including mercury, lead, and chromium, into the environment. Manufacturing vs. Use: For battery-powered devices like laptops, 80% of total emissions occur during production, not during usage. Industry Impact: The ICT sector is responsible for roughly 3.7% to 3.9% of global greenhouse gas emissions, a figure comparable to the entire aviation industry. Growth Projection: Emissions from this sector are expected to rise significantly, potentially reaching 14% of global emissions by 2040. Development Impact: Creating a single, light software feature can produce about 60 kg of CO2, while a "heavy-duty" feature can generate 300 kg or more. Key Drivers: Major contributors include data center energy consumption, network infrastructure, and the energy used by developers' machines. The rapid replacement cycle (typically 3 years) is driving these figures, with e-waste expected to reach 82 million tonnes by 2030. Only 17.4% to 22.3% of global e-waste is formally recycled, with the rest ending up in landfills, often polluting soil and groundwater in developing countries. Ryan's reasoning makes much more sense than yours. We should repeat politically correct slogans less like a parrot and use a little more common sense and human reasoning.1 point
-
Ah! My bad I misread your first post. I don't think I have a local setup with a non-namespaced TracyDebugger but if I do find one, I'll try to update and let you know if anything goes wrong.1 point
-
1 point
-
Some updates to the MediaHub module I've added an import tool that lets you pull in all the existing images on your ProcessWire site without having to re-upload anything manually. If you've been running PW for a while before installing Media Hub, you'll probably have images spread across dozens of pages and fields, and doing that by hand is nobody's idea of a good time. The new Import tab (v104) scans every image field on your site, shows you what's out there in a nice table with thumbnails, dimensions, file sizes, which page and field each image belongs to, and crucially flags potential duplicates. So you can spot that the same hero image has been uploaded to 12 different pages and just import one copy. You can filter by field, template, or search by name, then select what you want and batch import the lot with a progress bar. There's also an Import by URL option if you've got images sitting on your server or hosted elsewhere that you want to bring in directly. Nothing groundbreaking, just one of those quality-of-life things that makes the difference between a module people install and a module people actually use.1 point
-
The closest to a traditional setup for me would probably be: VS Code (or any fork or the Codium version) plus one of these extensions: Kilo Code, RooCode or Cline Coding Plan from either Z.AI or MiniMax.io VS Code an be installed almost everywhere without adding Node.js or other packages. The extensions can be installed from within VS Code but as they are quite similar, you should probably test them all. I kept Kilo Code as it felt to be the most stable and reliable one. Also Kilo Code offers additional features but only when using their subscription, for daily usage you can bring your own API keys and use those.1 point
-
Hello @_Roy_, you have to add or change the styles in the module settings, so that you can see it in the editor: https://processwire.com/blog/posts/using-tinymce-6-in-processwire/#customizing-the-styles-dropdown https://processwire.com/blog/posts/using-tinymce-6-in-processwire/#adding-extra-css-styles-without-adding-to-em-styles-em-dropdown You are right, ProcessWire doesn't know what framework you are using. That is why you have to tell the editor which classes of your framework you want to use. Regards, Andreas1 point
-
Hey everyone! I just released a new module called InviteAccess. It's something I built for my own workflow and figured it might be useful for others too. The problem: when handing off a staging site to a client or a design agency, you either open it to the world or reach for HTTP Basic Auth — which works but isn't pretty and requires server config. I wanted something in between: a proper gate page that looks like it belongs to the project, with separate codes for each team. What it does InviteAccess hooks into ProcessPageView::execute (before any template rendering) and blocks all frontend requests until a valid invite code is entered. Logged-in ProcessWire users always pass through automatically. You define codes in the module config, one per line: SUMMER2025|Summer Campaign AGENCY-PREVIEW|Agency Team CLIENT-ACCESS|Client Preview The label after the pipe shows up in the access log, so you can see exactly which team accessed the site and when. Features Multiple invite codes with optional labels Session-based auth — enter once, stays valid for a configurable number of hours JSON access log with timestamp, IP, user agent, URL — last 50 entries shown right in the admin config panel Light / Dark / Auto theme switcher on the gate page (saved in localStorage, reacts to OS preference) Accent color setting — red, blue, green or black Configurable allowed pages that bypass the gate entirely CSRF protection, hash_equals() for timing-safe comparison, Cloudflare-aware IP detection The gate page uses ApfelGrotezk font and a design inspired by processwire main page itself — warm gray background, white card, mobile-first. Screenshots Installation cd site/modules git clone https://github.com/mxmsmnv/InviteAccess.git Then Modules → Refresh → Install → Configure. GitHub: https://github.com/mxmsmnv/InviteAccess Happy to hear any feedback or suggestions!1 point
-
1 point
-
Show Image Custom Field Errors Makes custom fields for images visible when there is an error, e.g. empty required fields. Purpose Image fields have three view modes: square grid, proportional grid, and vertical list. In square grid and proportional grid modes only the thumbnail is visible and custom fields for an image are hidden until the thumbnail is clicked. This can cause an issue when any of the custom fields is an error state (e.g. a required field that has been left empty) because the relevant field will not be visible in the Page Edit interface, making it more difficult for the user to locate the field that needs attention. The Show Image Custom Field Errors module forces image fields into vertical list mode when there is an error in a custom field. When the error is resolved the image field is returned to the view mode that was in use before the error occurred. https://github.com/Toutouwai/ShowImageCustomFieldErrors https://processwire.com/modules/show-image-custom-field-errors/1 point
-
This module allows you to integrate hCaptcha bot / spam protection into ProcessWire forms. hCaptcha is a great alternative to Google ReCaptcha, especially if you are in the EU and need to comply with privacy regulations. The development of this module is sponsored by schwarzdesign. The module is built as an Inputfield, allowing you to integrate it into any ProcessWire form you want. It's primarily intended for frontend forms and can be added to Form Builder forms for automatic spam protection. There's a step-by-step guide for adding the hCaptcha widget to Form Builder forms in the README, as well as instructions for API usage. Features Inputfield that displays an hCaptcha widget in ProcessWire forms. The inputfield verifies the hCaptcha response upon submission, and adds a field error if it is invalid. All hCaptcha configuration options for the widget (theme, display size etc) can be changed through the inputfield configuration, as well as programmatically. hCaptcha script options can be changed through a hook. Error messages can be translated through ProcessWire's site translations. hCaptcha secret keys and site-keys can be set for each individual inputfield or globally in your config.php. Error codes and failures are logged to help you find configuration errors. Please check the README for setup instructions. Links Github Repository and documentation InputfieldHCaptcha in the module directory Screenshots (configuration) Screenshots (hCaptcha widget)1 point