Jump to content

michelangelo

Members
  • Posts

    68
  • Joined

  • Last visited

Profile Information

  • Location
    Den Haag, NL

Recent Profile Visitors

1,030 profile views

michelangelo's Achievements

Full Member

Full Member (4/6)

15

Reputation

  1. Hello, everyone, I have been experiencing an issues with PW ImageResizer. It usually works quite well but for images with lots of dark areas it seems to degrade the image. Looking through the forum and trying out different settings I came close to what I need but the colours are still off... Here is the issue: Original: Converted by ImageResizer to JPG and WebP (WebP is slightly worse): The settings I have are those: array('upscaling' => false, 'cropping' => false, 'quality' => 100, 'hidpiQuality' => 90, 'sharpening' => 'none', 'defaultGamma' => -1); I have also tried: – Changing the color space to RGB from sRGB in the ImageSizerEngineMagick.php but this didn't work as expected after I read more about it. – Converted successfully, without any loss in quality, with my local imageMagick. Probably it's a newer version? Anyways, my question is is this known issue, can something be done about it and if not—can I just use the original image and add a toggle switch on the client side?
  2. Thank you, @horst! I did what you suggested, the transparent pixel as a source works well and we started optimizing the images because they were huge PNGs.
  3. Hi @horst, thank you so much for the tips! 1. Those 1800 version images are upscaled from PW, I will need to fix that and I think it's because I am using the ->width() of the image object not ->size(). I will maybe remove all version of the images and render them again. 2. I left sizes at 100vw as I need to have good resolution images in case you expand the grid, but I will try to optimise this too. I think the size of the images is much more problematic. 3. The images are huge indeed. I forgot that I should explicitly tell my client to use JPEGs, we do need PNGs sometimes but it's rare... 4. JS basically waits for the images to load and then relayouts MasonryJS, I will tweak it so it doesn't wait for all of them. 5. Using small data-image is new for me, I will take a look. Thanks again :))
  4. Hello guys, I am working on a website right now which has a problem with image load times https://comeinyourewelcome.nl/artworks/ I hope you can give me some advice on how to make it faster. – I usually have PW resize my images in several widths [320, 480, 768, 1240, 1800] and I made it so it doesn't upscale it. – I also have AutoSmush installed which reduces their sizes a little bit. – And native lazy loading of course. The problem arises as I am using MasonryJS to create my layout thus I don't want to implement infinite loading kind of thing. The browser says that I have slow server side response... Is there something fundamental that I am missing? Thanks a lot in advance!
  5. It worked! I don't know how I missed that. I was pretty sure I checked the path that was generated with docroot, but I guess I won't forget it next time. I am leaving it for a few hours now to test with my actual script and hopefully it's all good. Thanks for the quick tips, guys!
  6. Hello guys, I have never worked with cronjobs and it seems that after some digging I am almost there, I just need to make sure I include Processwire in the mix. I have included the script and my output under the explanation. Some info on my setup: – Using Hostinger's hPanel cronjob every hour – Connected to a script in my templates folder called cronjob.php (The script is tested and it works) – The script logs some data in cron_test.txt – It seems everything works until it reaches the first Processwire instatiation and it stops. Unfortunately, no errors are logged in hPanel or Processwire logs and I get no errors if I access a page that is using this template. The script cronjob.php <?php namespace ProcessWire; // =-=-=-=-=-=-=-=-=-=-=-= // Save the images in pages // =-=-=-=-=-=-=-=-=-=-=-= $pw_path = $_SERVER['DOCUMENT_ROOT'] . '/index.php'; include_once($pw_path); $t = time(); $t = date("H:i:s", $t); $id = 'test-cron-' . $t; $thumb_url = 'https://im0-tub-ru.yandex.net/i?id=84dbd50839c3d640ebfc0de20994c30d&n=27&h=480&w=480'; $timestamp = '116161822'; $caption = 'Cron-job-test'; saveImageToDB($id, $thumb_url, $timestamp, $caption); function saveImageToDB($id, $thumb_url, $timestamp, $caption) { $crontext = "Cron Run at ".date("r")." by ".$_SERVER['USER'] ." with PW bootstrapped \n" ; $folder = substr($_SERVER['SCRIPT_FILENAME'],0,strrpos($_SERVER['SCRIPT_FILENAME'],"/")+1); $filename = $folder."cron_test.txt" ; $fp = fopen($filename,"a") or die("Open error!"); fwrite($fp, $crontext) or die("Write error!"); fclose($fp); echo "Wrote to ".$filename."\n\n" ; echo "0"; $p = new Page(); // create new page object echo "1"; $p->template = 'nk-image'; // set template echo "2"; $p->parent = wire('pages')->get('/images/'); // set the parent echo "3"; $p->name = $id; echo "4"; $p->title = $id; $p->save(); // populate fields $p->text_short = $thumb_url; $p->image->add($thumb_url); $p->timestamp = $timestamp; $p->textarea = $caption; $p->save(); } In the hPanel I get the output: Wrote to /home/u9999999999/domains/domainname.com/public_html/site/templates/cron_test.txt 0 and in cron_test.txt: .. Cron Run at Sun, 15 Aug 2021 06:00:02 +0000 by u999999999 with PW bootstrapped Cron Run at Sun, 15 Aug 2021 07:00:02 +0000 by u999999999 with PW bootstrapped Cron Run at Sun, 15 Aug 2021 08:00:02 +0000 by u999999999 with PW bootstrapped Cron Run at Sun, 15 Aug 2021 09:00:01 +0000 by u999999999 with PW bootstrapped What am I missing? I feel I am so close ? Thank you!
  7. Hello guys, I am trying to integrate mathJax but I cannot get it show in the toolbar. Can you share the steps that you are following? I started from here https://ckeditor.com/cke4/addon/mathjax, but I cannot get it to be displayed in my editor. Thanks!
  8. Hi @adrianthank you for the module, I have been using it for years on and off and it has saved tons of work! I have a question regarding inline editing. I know it has been asked a lot but I have only 1 field to edit per page and wondered if I can go without purchasing ListerPro? This is how my setup looks like. Imagine that I just have to pick some categories in Category Reference and potentially delete the page. Can you give me a hint/direction how I can approach this? Thank you!
  9. Hello @VeiJari I recently setup https://processwire.com/modules/rest-api/ and I couldn't get it to work easily on localhost. How are you testing it? Maybe it can save some trouble by trying to deploy it somewhere?
  10. Hello guys, I have an issue that might be solved with the Lister module or ListerPro. I don't want to order the paid module if it's not necessary. That's why I wanted to ask first. I have multiple images that my client wants to be able to go through and categorise them. The structure in a lister looks like this: The "Category Reference" is related to a few categories that are in multiple groups: I would like to have those options show up in the Lister and be able to quickly select them. This is how the categories look like in the Image page itself: Is there a way to do it with the built in PW modules? I just want to have the table-like view in the lister and in the "Category references" to have my three options "Cloth, China, Surgical". Thanks!
  11. @teppo That's a good point about the Instagram policies, I will go over it once more. Maybe writing the scraper in PHP is better idea than switching to a completely different stack where I have to build the backend and everything from scratch. Thanks! Out of curiosity though: It is possible to run a python script with a cronjob, right?
  12. Hello everyone, I would like to ask for some advice on what options I have to build an app I have in mind. It will scrape images from instagram and save each of them as a PW page, then the admin can edit them and it will be displayed on the front-end. The challenge for me is to have a cronjob, to run a scraper maybe written in Python, and populate the database using the PW API. Is this sensible? Is it suitable to use PW for this or should I use another technology?
  13. @horst so I guess this will work If I hook that method every time I access www.website.com/api/ route? And then monitor how many requests I get. I just have to figure how to do those.
  14. Hello everybody, I am currently indulging myself into building a REST API based on a older project of mine. It's very simple where you can mainly retrieve information in JSON. It's similar to JSON Placeholder in the level of complexity. I am using the RestAPI Module and native ProcessWire API functions. Rate-Limit Throttling is something I want to implement because it's public without authentication, despite not extremely necessary. Now, is it better to utilise something like Token Bucket or ProcessWire already has some protection against too many requests? There is a simple Token Bucket library I found that is going to work but I want to limit the traffic only to the /api/ route, not to my whole website. All input is appreciated, later I will share the project here. Thanks!
  15. Thanks for the suggestion, however this has the same infinite loop effect as the ::loaded hook. It just goes Page::render -> Saml -> Page::render -> Saml -> ... Okay, that's silly but I just added a condition to actually check for the Saml Response. This way it doesn't try it after the user is in... Thanks @louisstephens if (!isset($_SESSION['samlUserdata'])) { // User not logged in to SAML $this->session->addHookBefore('PageRender::renderPage', $this, 'loginsaml'); }
×
×
  • Create New...