Jump to content

rash

Members
  • Posts

    112
  • Joined

  • Last visited

Profile Information

  • Location
    Stuttgart, Germany

Recent Profile Visitors

1,821 profile views

rash's Achievements

Sr. Member

Sr. Member (5/6)

41

Reputation

  1. Hi guys, I'm struggling with a PageReference inside a Combo, and the Combo is part of a Repeater Matrix. The PageReference is supposed to offer only child pages of the current page, so I use the selector string parent=page.id in the field settings. As expected, the PageReference offers all child pages (and nothing else), but saving the page throws an error for each selected child page: Page 1103 does not match findPagesSelector: parent=page.id, id=1103 Page 1106 does not match findPagesSelector: parent=page.id, id=1106 etc. Funny thing is, that the exact same construction (including Combo/Repeater Matrix) is running since years on another project, so I really don’t understand what’s going on here. Why does the PageReference offer a correct selection, but doesn’t accept the result? Supplement: For test purposes I took the Combo out of the Repeater Matrix, the problem remained the same. Next I took the PageReference out of the Combo, then everything worked. Obviously the problem is somewhere in the nested field construction. Is it possible to have a PageReference like the described one inside a Combo field and what would be its correct selector string? (And I’m still wondering why the same construction works on another site.)
  2. Hi @horst, I’ve installed CroppableImage 4 additionally to 3 and everything works fine, except clicking on thumbnails in the image field. The modal window opens and says 'ProcessWire: Unrecognized path' followed by something like 'process didn’t deliver any content' (exactly: 'Der Prozess hat keinen Inhalt ausgegeben'). This happens in fields with CI3 as well as with CI4. The URL is looking good so far: /page/croppable-image-4/?filename=file-XY.jpg&suffix=square&width=420&height=420&pages_id=1781&field=imgs&modal=1. Before installing CI4 this didn't happen. PW is version 3.0.184. Edit: Meanwhile I deinstalled both versions and reinstalled V3, that is working as before now. I might wait with V4 until it’s "officially" released.
  3. @horst Thanks very much for your detailed explanations that help me quite a lot. Following your arguments, I’m indeed comparing apples with bananas. Usually I’m working with a mixture of your strategies A & B by using one image "as is" and create further JPG variations of them, mostly thumbnails, where neither quality nor file sizes are somehow critical. As I’m planning to use WebP and a broader palette of size variations, I should probably seize the opportunity to overthink my (bad) habits and switch to pure strategy B. Embarrassingly, I never came up on the idea to use config settings for image processing, probably because I didn’t feel an urgent need for it. With strategy B they seem to be useful if not essential. So thanks for that important hint too. I will do a serious testing with all those brand new perceptions.
  4. @MoritzLost I actually don’t know which component is doing the conversion, both are running on the server. As I usually tend to go the easiest way, I just rely on PW so far: calling $img->webp->url produces a WebP. So I might dive into the deeper areas of the docs as soon as I find a little patience … The mentioned difference between the two servers results from different compression rates of JPG sources, at least that is clarified now.
  5. @MoritzLost I agree. Unfortunately, it’s the other way round until now: slighty better images with considerably larger file sizes. But I’m working on it ? I already use a picture element with different sources and want to establish responsive image sizes in the next step. And I already know your tutorial and find it pretty helpful – thanks for it! I’m not giving up yet, just had to whine a bit yesterday, because everything appeared so sadly. Regarding your settings proposal: Where could I set quality levels on a shared server with limited access to it’s settings? It‘s indeed annoying me to have either WebP or not WebP without knowing how to affect the result.
  6. @adrian Thanks for your feedback, glad to know I’m not alone. Meanwhile I did a bit more testing and found a clear correlation to the JPG compression rate. In Photoshop, a quality setting of 70 (of 100) and better leads to fairly or even much smaller WebPs, while the saving decreases with lower quality until there happens a turnaround to even bigger WebPs, approximately at 60. (The Photoshop value 70 seems to correspond to 65 in Lightroom, a bit more than 80 in Affinity Photo and something around 90 in Pixelmator Pro. The "good" JPGs on server 1 were produced by Lightroom with setting 70 and therefore match the pattern.) All things considered, the advantage of this "next-gen format" is hard to detect. To achieve a noteworthy saving in the WebPs, you have to produce unreasonably big JPGs first, but the resulting WebP will be bigger than your more realistic old-school JPG before. Measured in figures you might have better image quality, but I doubt that the difference will be recognized by the average user. So there’s a good chance that I will join your waiting-for-avif-club.
  7. Hi guys, I’ve recently set up 2 PW installations for using WebP images (following this explanations, strategy 3). Both servers run on identical system configurations and PW versions (3.0.184). While integrating the WebP functionality was no problem at all, I’m massively confused by the results: one server works as expected, the other one does the sheer opposite. Server 1 (the good one): Images total: 326 WebP bigger than JPG: 41 (on average more than 40 %) WebP smaller than JPG: 285 (on average 30–40 %) Server 2 (the bad one): Images total: 862 WebP bigger than JPG: 773 (on average 30–40 %) WebP smaller than JPG: 89 (on average less than 10 %) As far as I know, the quality of the source JPG has an impact on the WebP: highly compressed JPGs may lead to hardly smaller or even bigger WebPs, while the savings with high quality JPGs tend to be more spectacular. Server 1 seems to confirm this assumption (the JPGs with bigger WebPs here are highly compressed 3rd party images) while server 2 ist acting completely strange. The source JPG’s size is around 1.200 x 800 pixel with a moderate compression rate and file sizes ranging between 100 and 500 kB with an average of 250 kB. The JPG quality on server 1 is about the same (regardless the 41 lousy ones), the only difference is their smaller size of 900 x 600 px with an average file size of 150 kB. So I’d consider the WebP use on server 1 as clearly progressive, while server 2 essentially limits itself to fill up the webspace with bigger images that will never appear on a display. Is there any influence on the WebP conversion I might have missed?
  8. Hi guys, I’m stuck on trying to set up a Remember Me function for frontend user logins. I’m using Login/Register to handle the logic and everything is running fine. To add the option of keeping users with a specific role persistently logged in, I’ve installed LoginPersist which does exactly what I want, as long as I use it in Automatic mode. Since it’s not always a good idea to play games in the background without letting the user know, I would prefer to let him check whether he wants to be remembered or not and use LoginPersist in Manual Mode. The doc says: I will probably be able to check the response, my problem is to get the Remember Me checkbox into the form, ideally between the password field and the submit button. The form is rendered with $loginRegister->execute(); My guess is to hook somewhere in one of the loginRegister methods, but unfortunately I can’t find a working approach.
  9. Not solved, just bypassed: Fresh PW install into a different root directory on the same machine, moved old /site/ directory to the new install and set config.php to the old database and user salt. After clearing the cache and session folder, everything runs fine now. Fortunately, this very obscure situation appeared on a site that is managed by myself and nobody else. To have this on customer work would probably be a nightmare. I don’t know if it’s possible or rather a security issue, but I would appreciate it very much if an error message would reveal a bit more than 'This request was aborted because it appears to be forged'. The error seems to occur repeatedly at least since 2012 without any systematic debugging strategy beyond guesswork into the blue. To hear that something went wrong is arguably better than complete silence, but a bit more information what the system doesn’t like would be helpful.
  10. @Pixrael Thanks for your help. Your thread is one of those I read before, but it didn’t lead me much further. It seems as if the error can have approximately thousand different causes and so the 127+ forum topics you mentioned are mostly guesswork with some enviably happy winners. That’s not meant sneeringly, I know that server based issues can be very hard to catch. In my case I’m not sure whether I’m struggling with a server case at all. When you go to bed with a working site and wake up the next morning with an unworking one without any changes on your system, it’s not very likely that your database acts suddenly strange or your PHP session path is not writable anymore. Furthermore I copied the site to a local environment in the meantime, where precisely the same shit happens. As far as I can see, it has to be something inside the /site/ directory or the database. As I updated to the latest dev version, /wire/, index.php and htaccess should be fine.
  11. As far as I understand it right what you want to achieve, I would loop through all pages with an API script, delete the old image(s) of each, put the new image(s) to the same field and save the page. I have a similar situation on a site where a lot of images get synced with external sources very often and the delete & save method works reliable.
  12. Hi all, on a site working flawlessly since a few years, I suddenly cannot login anymore, all I get is 'This request was aborted because it appears to be forged'. The site runs on a shared hosting server, my last active changes happened many months ago and the hosting service usually changes nothing without clearly notifying it long before. Means: I haven’t got the slightest clue where to start. Of course I’ve used the forum search, read probably all related threads and followed the most hints (some of them are pretty old, so I decided to be cautious) but no success. A few facts: - I don’t know the exact PW version as I can’t find it outside the unaccessible backend, but it should be at least 3.0.16X. - TracyDebugger is in use on this site, but not SessionHandlerDB. - I deleted /site/assets/logs, /site/assets/cache and /site/assets/session. Before I did that, all of them were writable. - I replaced index.php with the latest dev version. - When I set $config->protectCSRF to false, the message disappears, but the login page gets constantly reloaded. - Setting $config->debug to true delivers 'Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in .../site/config.php on line 104', followed by warnings, that the header was already sent by.
  13. @BillH Meanwhile the hook is working. All data is collected in one textarea that I’ve set to hidden. It still is a workaround in the sense of not going the direct way, but it does what I wanted to achieve without any noise or bad smell, so I would call it an excellent solution. Means: my efforts on searching for something different declined dramatically. Here is the complete hook – less for you as the "inventor", but for others that may get stuck at the same point. I keep the code in /site/templates/admin.php as it is admin related only, but /site/ready.php would work as well. <?php $wire->addHookAfter("Pages::saveReady", function($event) { $page = $event->arguments(0); $page->of(FALSE); // disable page formatting $cache = ""; // string collecting the single fragments if ($page->template == "invoice" || $page->template == "standard") { // blocks is a Repeater Matrix field with the types item and text foreach($page->blocks as $block) { if ($block->type == "item") { $cache .= $block->title." "; $cache .= $block->body." "; } else if ($block->type == "text") { $cache .= $block->body." "; } } // notes is a direct child of $page $cache .= $page->notes." "; } else if ($page->template == "customer") { // cust_base is of (pro) field type Combo, it stores data different // from Repeater Matrix fields but shares a similar syntax $cache .= $page->cust_base->street." "; $cache .= $page->cust_base->city." "; $cache .= $page->cust_base->shorthand." "; $cache .= $page->cust_base->phone." "; $cache .= $page->cust_base->email." "; $cache .= $page->notes." "; } else if ($page->template == "contact") { // cust_contact is a Combo field too $cache .= $page->cust_contact->prename." "; $cache .= $page->cust_contact->surname." "; $cache .= $page->cust_contact->phone." "; $cache .= $page->cust_contact->email." "; $cache .= $page->notes." "; } // searchcache is a simple Textarea field that can be included // as a searchable source in Modules/Core/ProcessPageSearch $page->searchcache = $cache; }); ?>
  14. I am happy too! Though I don't understand why the typecasting didn’t work, (int) "40000" (or intval("40000")) should result in 40000, not 0. Strange …
  15. The most simple way to achieve that is to call a detail page (based on a detail template) and specify the news item with a get parameter like so: <p><a href="/newsdetail/?newsid=<?= $item->id; ?>">read more</a></p> In this case, your detail template would contain only the logic to receive an id and render the markup for $item with the given id. If you don’t like get parameters, you could alternatively use form submits instead of <a href> and send the ids as post variables.
×
×
  • Create New...