Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by horst

  1. Hi @iipa, after (re)naming the cropsettings lowercase [a-z0-9], the issue is gone, or not?
  2. @pwired I'm not sure if you really know what or about what you are talking? But I definetly know that I really dislike such sort of posts. Please revert back to kindly posts only. And, if you want to answer me to this post, please do it via PM to me. (I'm into weekend now and only can answer on monday next week, but will definetly do.)
  3. Maybe I will have one in a week or few days, as I just yesterday uploaded a new project to a custom stage, where the customer uses an own server where I could configure apache for PW, but nginx seems to be in front of it as a load-balancer. I'm not sure how this works, as I had no time for looking around or asking, but maybe this is a similar setup as Sergio mentioned? (When I reloaded the apache service during the installation setup and I hit F5 to early in the browser, I got a nginx message "Bad Gateway"). The site will go live next week, I think.
  4. This sounds even better. I will read the linked article. If we really can use it and have polyfill fallback, we can let out lazyload libraries. That would/will be great. :)
  5. That would be nice: this -> "works if JavaScript is disabled" But how long will it take until all other browsers support it too? ;-)
  6. Hi @Hardoman I post you a code example below that works for me since ages and also with recent PW versions. It includes watermarking too! It is called in a custom module and the event is >before "InputfieldFile::fileAdded" <, but you can call it in ready.php too. Hopefully it is of help for you. Otherwise please ask further. :) public function importImage($event) { $inputfield = $event->object; // handle to the image field if(!$inputfield instanceof InputfieldImage) { // we need an images field, not a file field return; // early return } if(version_compare(wire('config')->version, '2.8.0', '<')) { $p = $inputfield->value['page']; // get the page, PW < 2.8 } else { $p = $inputfield->attributes['value']->page; // get the page, PW >= 2.8 | 3.0 (or only from 3.0.17+ ??) } if('images' != $inputfield->name) return; // we assume a field with name: images if('album' != $p->template) return; // don't do it on other pages than archive album $image = $event->argumentsByName('pagefile'); // get the image // prebuild variations // AdminThumb $image->height(260); // AlbumThumbnail $portrait = $image->height > $image->width; $w = 228; if($portrait) { $w1 = intval($w); $h1 = intval(($w1 / 3 * 4) + 38); } else { $w1 = intval($w); $h1 = intval(($w1 / 3 * 2)); } $image->crop("width=$w1, height=$h1"); // Slick-Slideshow $wmPng = $this->pages->get('id=13967')->getUnformatted('watermark')->first()->width(403); // sharpening added, quality from 80 to 90 $master = $image->contain('width=1000, height=700, quality=100, sharpening=none'); $master = $master->pim2Load('full', false)->watermarkLogo($wmPng)->setQuality(100)->setUpscaling(true)->setSharpening('none')->pimSave(); $sizeArray = array(array(448, 336), array(678, 506), array(908, 676)); foreach($sizeArray as $sizes) { $master->size($sizes[0], $sizes[1], array('upscaling'=>false, 'cropping'=>false, 'quality'=>90, 'sharpening'=>'soft')); } // sharpening added, quality from 80 to 90 // prebuild variations // check / import IPTC data $additionalInfo = array(); $info = @getimagesize($image->filename, $additionalInfo); if($info !== false && is_array($additionalInfo) && isset($additionalInfo['APP13'])) { $iptc = iptcparse($additionalInfo["APP13"]); if(is_array($iptc) && isset($iptc["2#025"]) && is_array($iptc["2#025"]) && count($iptc["2#025"])>0) { $tmp = $iptc["2#025"]; $tags = array(); foreach($tmp as $k=>$v) { if(empty($v)) continue; $tags[] = jhpTextConversion(trim(strtolower($v))); } $p->images->trackChange('tags'); // prepare page to keep track for changes $image->tags = implode(', ', $tags); $p->save('images'); // save the page } } // check / import IPTC data }
  7. Not sure, but maybe you are missing an ->add with the $page->$file_field ??
  8. Yes, especially in my example its not obvious. But all sites where I used that belong to the same agency. And only agency members maintain those pages, not the clients. With other solutions, where I use the show_only_if functionality, I always only use it with checkboxes or radios as toggle controls, where the toggle controls always stay visible. I also do it the same in the template. I don't give it as choice for the editors.
  9. Hi @MoritzLost, great Tutorial again! :) I'm short in time but can give an example for a custom solution that I use sometimes. It suites for small sites or landingpages where the clients have the need to also include external links into the main menu. PS: .. and yes, I try to avoid those things and instead try to stick with the native page tree hirarchy, as it is less error prone for the customers as with an additional layer involved.
  10. Really like what I‘m reading here. 😀❤️
  11. I'm not 100% sure, (but think so), if you will get better support when posting this into a dedicated Twig Thread, if there is any. Unfortunately I don't know anything in regard of twig. But there are modules available for twig template engines and when posting there, it may reach more users of twig, if they have set notify for new posts in that thread.
  12. This looks good! Will try it in the afternoon. Many thanks. 👍
  13. When I load a site per link with URL & anchor (https://www.example.com/#anchor), is it possible to catch / prevent the native jump and instead delegate this to an own javascript? I found many resources about smoothscrolling within a doc, but I need to know if there is an event that can be catched, before a browser does a native anchor jump. :)
  14. Hi @iipa, here are some useful links: I use the hook from Ryan since a few weeks and it works really good: Maybe one can this adapt to match more than inline styles. (?)
  15. @toni Great to hear you solved it! 👍 I set the thread title to "[SOLVED] ... ". The forums software allows editing of the thread title when opening the initial post.
  16. @toni Very often it has to do with not enough memory for loading the source image into ram and create the variation(s). Check PHPs max_memory and if possible, use the imagick image rendering engine, as it can process images in chunks or lines, whereas the GD library always need to load the complete uncompressed image into ram.
  17. @gmclelland here are screenshots of my use case and solution with the medialibrary module and the imagepicker module: This is very nice solution. The site owner likes it. She can select completly visual. No distracting informations around. Just the icons. :)
  18. @gmclelland many thanks. Will have alook at it. Meanwhile I had solved it with bitpoets medialibrary (and maybe something other in combination? Don‘t remember correct atm.)
  19. No, sorry, no snippet at hand. But you can look into any TextformatterModule that deals with images, as they do exactly that (parsing the markup and identify images). Look into the modules directory to find some. ;-)
  20. Hi and thanks for this useful module. I added to my list of things I need to explore soon. ;-) A common usage for modules that need to inject content in the head or body output of pages, is to optionally serve a manual way per API call besides the automatic way.
  21. I think, you need to parse the html markup of the textarea field(s) for <img src="..." />, collect any found in an array, and then, when displaying all images from the images field, compare each name with the collection and skip those that exists in the collection.
  22. Hi Pete, I'm not sure if this is of any help with editing user, as it all belongs to page edit buildform. But maybe you just have to look for ProcessUser instead of ProcessPageEdit like in this related snippet: protected function afterBuildForm(HookEvent $event) { // Only for ProcessPageEdit (not ProcessUser) if($this->process != 'ProcessPageEdit') return; Here are some links to posts with tips and other links on this topic for pages: https://processwire.com/talk/topic/17444-modifying-tabs-moving-fields-to-another-tab-in-page-editor/?do=findComment&comment=153312 https://processwire.com/talk/topic/19537-pageeditor-children-tab-possible-to-load-children-directly-on-open/?do=findComment&comment=169412 https://processwire.com/talk/topic/14887-hook-to-hide-inputfield-in-admin/?do=findComment&comment=133586 Regarding this useful information, you cannot completly remove the name filed, but hide it:
  23. Hi @kixe, additionally to what @jploch said above, and when you are already at it ;-), it would be very helpful to have the option for auto-backup on login! The real life usage of auto backup on logout is not consistent because some users simply leave the backend without logout process. So I would prefer to switch to auto backup on login process. :-) (Login process can not be skipped like Logout process!)
  24. What's about a cache busting param with the last modified timestamp of each image variation file? /site/assets/files/1/basename.300x0.jpg?ts=1565267238
  • Create New...