Jump to content

Clément Lambelet

  • Posts

  • Joined

  • Last visited

Profile Information

  • Location

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Clément Lambelet's Achievements

Jr. Member

Jr. Member (3/6)



  1. Hi @Sebi ! Thanks a lot for your long reply! Regarding the 404s, I totally understand. I remember now that I had used the same kind of hook for a module a while ago. But would it make sense to remove the "404" part of the url in the log? It's really a cosmetic thing though, not fundamental. Thank you very much for testing whether Session Login Throttle works. I am reassured! I think it's my implementation that is not quite right yet. I'll keep testing and ask a new question if I really can't find a solution. Thanks again for your help!
  2. Hi @Sebi! Thanks a lot for your module, really great, having fun with it for a little side project! After some testing, I have a two questions: First thing (not really essential and I may have made a mistake in the way I set things up), but the access-log shows all urls as starting with "/404/". JS side requests are working fine (http 200). The rest of the url shown in access-log is fine. A little more significant, the function that handles authentication does not seem to respect the Session Login Throttle settings (I'm using double JWT). I'm a bit paranoid perhaps, but this seems to present a risk of brute-force attack. Is this the case, or is my implementation wrong? Thanks a lot!
  3. Thanks a lot for your replies! @Zeka I was hoping it was not too late to hook during module's init method, alas... And I can't really add the hooks to initBefore.php or boot.php as the idea is to release the module publicly (and that it works without the end user having to add a hook himself). @Jan Romero Super interesting this new preload feature! I'm just wondering if it's not a bit of a loss to create a module that requires the Dev branch. I've currently developed it to work on the Master branch. Anyway, this functionality is not super fundamental to the module. I will for the moment, as you recommend, get the time during the init of the module. Thanks again!
  4. Hi! Sorry to bump this, but I'm still trying to wrap my head around this. I re-read $wire->init() reference. It states "Hookable init for anyone that wants to hook immediately before any autoload modules initialized or after all modules initialized". I would expect that $this->addHookAfter("ProcessWire::init", $this, 'addMark'); to works, as the module is autoloaded. Why is this hook not working ? Would there be a workaround? I'm looking to hook as soon as possible during Processwire execution.
  5. Hello, I'm working on a module wich will do some performance monitoring. I would like to be able to record time during the main hooks of Processwire. But unfortunately, the Processwire::init hook never execute, either with addHookBefore or addHookAfter. Here is a minimal test case, output is in a TracyDebugger bar dump. <?php namespace ProcessWire; /** * Minimal test case to hook to Proceswire::init * Output is a TracyDebugger bardump * */ class HookInit extends WireData implements Module { /** * Array to store all server-timing marks * * @var array */ public $marksArray; public static function getModuleInfo(): array { return [ 'title' => __('Hook Init'), 'singular' => true, 'autoload' => true, 'requires' => [ 'ProcessWire>=3.0.165', 'PHP>=7.1.0', ], ]; } public function __construct() { $this->marksArray = array(); } public function init() { // DOESN'T WORKS $this->addHookBefore("ProcessWire::init", $this, 'addMark'); // DOESN'T WORKS $this->addHookAfter("ProcessWire::init", $this, 'addMark'); // WORKS $this->addHookBefore("ProcessWire::ready", $this, 'addMark'); // WORKS $this->addHookAfter("Page::render", $this, 'addMark', array("priority" => 199)); // Display in TracyDebugger bar dump $this->addHookAfter("Page::render", $this, 'displayMarks', array("priority" => 200)); } /** * Add a server-timing mark to the array * * @param HookEvent $event */ public function addMark($event) { $this->marksArray[$event->id] = microtime(true); } /** * Output $this->marksArray via TracyDebugger * * @param HookEvent $event */ public function displayMarks($event) { bd($this->marksArray); } } ?> I am definitely doing something wrong (still learning...). Any help will be greatly appreciated! Thanks!
  6. Okay, I found the issue! I should have mentioned that I work on a multi-lingual site. Here's the problem (and the resolution): I removed the value "inherit from default language" for the field Title (because the inheritance didn't seem to me to be the right approach for the translation of this field). This had the effect of making the title empty. If I reactivate the inheritance, the problem is solved. Thanks a lot for your help, really like PW community!
  7. Hi Edison, thanks for your reply! It's sadly not a css issue. I checked and there is no text inside the link. Attached is a screenshot of the Setup dropdown menu (uikit theme), as you can see there is no text in the markup. I didn't change or add js. Before the bug occured I was changing the main list of pages (via ProcessPageListRender::getPageLabel in site/ready.php), but if I comment out the code the bug still occurs.
  8. Hey! I've been working on a Processwire installation (3.0.123) for a few days now and I must have made a big mistake this morning because the links in the admin's main menu no longer appear. This is not related to the admin theme, because the bug occurs with all themes (Default, Reno, Uikit). I tried to reinstall with the dev version (3.0.136), but the problem is still there. I also uninstalled all the modules I had added, without success. There is no error in the js console. I still can access/view/edit the pages by going through the admin/page list. Thanks in advance for your help!
  9. Hi all, thanks @bernhard for this idea. I didn't know how to implement wire-queue properly. So I went with a more simple way (for myself) which was to modify InputFieldImage.js (in wire/modules) , and make an ajax call to a script which resize the images. I'm pretty sure it's not the best way to do that, but it's working better (the server seems to handle the resize better if it's from different requests). It takes around 10 sec to generate the 7 sizes (with GD) compare to a 60 seconds timeout before. Thanks for the help. I will mark the topic as solved.
  10. Thanks for your help. FYI, here's some server config I could find: PHP version 7.1 max_execution_time 60 seconds memory_limit 640 Mo I can modify .htaccess, but can't change php.ini or user.ini. I could try to use ini_set() in a php file, but don't know what to put. I will ask my host (infomaniak), if it would be possible to add IMagick. As for the pages, they are quite simple: https://c-lambelet.com/new/en/projects/collateral-visions/ Here's the code responsible to generate the variations (excerpt): $options = array( 'quality' => 71, 'upscaling' => false, 'cropping' => false, 'sharpening' => 'none' ); if($size == 1) { // context specific, here's means full width of browser window $i400 = $image->width(400, $options); $i800 = $image->width(800, $options); $i1200 = $image->width(1200, $options); $i1600 = $image->width(1600, $options); $i1850 = $image->width(1850, $options); $i2250 = $image->width(2250, $options); $i2650 = $image->width(2650, $options); $i2880 = $image->width(2880, $options); $markup = '<img src="'.$domain.$i400->url.'" srcset="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-srcset="'.$domain.$i400->url.' 400w, '.$domain.$i800->url.' 800w, '.$domain.$i1200->url.' 1200w, '.$domain.$i1600->url.' 1600w, '.$domain.$i1850->url.' 1850w, '.$domain.$i2250->url.' 2250w, '.$domain.$i2650->url.' 2650w, '.$domain.$i2880->url.' 2880w" data-sizes="auto" class="lazyload" alt="'.$alt.' - © Clément Lambelet">'; } --- I'm afraid someone else has to look into this (relatively new) method and check if there are options... Anyone would have an idea for this hook? I would be really interested for other uses as well (like auto tagging of the image).
  11. Hi dragan, thanks for your message. I don't have any timeout error in the backend (or any error at all for that matter). I saw that the variations are only generated once, but I'm still losing a lot of time to generate them. The last page I created had 15 pictures and it took about 7 minutes to generate all the variations (7 timeout errors). It kind of break my workflow to have to wait that much and it really slows every other pages (which will be bad once I want to add pages to the public site). Should I try to have less variations? It seems to me that for responsive images (srcset), it's okay to have 7 different sizes. I would really prefer to have a way to generate them via the client-side image resizing script.
  12. Hi all, I'm really new to ProcessWire, maybe I missed the solution in the documentation. I'm working on a site which involves a lot of image upload fields, and I'm always getting many timeout errors. I'm pretty sure it's because I generate too many variations on a single page load (around 20 images with 7 different sizes, for them to be responsive). I can't use ImageSizerEngineIMagick to help (my host doesn't support it). I was wondering if there was a way to hook to the process of client-side image resizing (https://processwire.com/blog/posts/processwire-3.0.63-adds-client-side-image-resizing/) to generate the different variations (as it seems really faster). If not, is there a way to generate the different variations on upload and not on page load ? Any ideas and suggestions are welcome!
  • Create New...