-
Posts
4,088 -
Joined
-
Last visited
-
Days Won
88
Everything posted by horst
-
Get pages by multilanguage <option> value/title
horst replied to xxxlogiatxxx's topic in Multi-Language Support
Not 100% sure, as I do not work with options fields, but if you want to search for title values other the default language, you need to add the ID of that language to the fieldname. As example, if your italian language would have the ID 1020, you would have to query for: encyclopedia_item_type.title1020={$type} see: -
@ryan Oh WOW, a dream comes true! ? ? ? ? ? ? ? ? ? ? ? ? ? ?
- 3 replies
-
- 11
-
-
@David Karich & @kalimati Which PW version(s) do show this behave? AND: which ImageSizerEngine(s) have you enabled there? (GD | IMagick) We had a change in what image types are supported by IMagick and need to revert back some sorts of PNGs, especially 8bit PNGs are not correct supported by IMagick, and in very rare cases there also was wrong handling for some 8bit-PNGs in GD-Engine. Maybe you can provide the informations plus one or two of the (original uploaded) images in a ZIP to me?
-
Adding "object" in from of returned json from "api"
horst replied to louisstephens's topic in Dev Talk
Yes, you will get it like with this code: $out = new \stdClass(); $out->clients = []; foreach([0=>['id'=>'abc'], 1=>['id'=>'xyz']] as $client) { $out->clients[] = $client; } header('Content-Type: application/json'); echo json_encode($out); see: https://www.php.net/manual/en/language.types.object.php#118679 -
Adding "object" in from of returned json from "api"
horst replied to louisstephens's topic in Dev Talk
I believe this would result in erroneous JSON syntax. Your 'clients' need to be a (key or property) element of either an object or an array, not a preceding string. -
@Hardoman If I understand correct, you want to watermark the original image. Is this right? If so, you may want to watermark the original image directly. This way you don't need to delete the original image and copy / move around the watermarked variation. If you look into the PIM docs, you will find a description how to work on system files instead of Pageimage objects. This would be the way to go. see this post, the 3 tip: https://processwire.com/talk/topic/4264-page-image-manipulator-1/?tab=comments#comment-41748
-
Best Practice to determine if admin from init method?
horst replied to Noel Boss's topic in API & Templates
Hi @Noel Boss, - I haven't understand why you need init() and why you are not able to use ready(). (Maybe, because you haven't told ? ) But what about testing with prioritizing your hook(s)? Maybe with init() it may run lately, or in ready() (as one of the early birds), will do what you are after?? Links: https://processwire.com/docs/modules/hooks/#hook-priority and -
Ah ok. There is no build in solution for this. You have to build something yourself. For example, if there is currently no use of tags, (or an expandable usage of tags), with this imagefield, you may setup tags with predefined values, so that the user can select one if he like to. If this is not possible due to restricted other usage of tags, it may become very uncomfortable, as there are currently no other fields bundled together with an image (besides description and tags). I'm not sure if the imageextra module from justb3a is uptodate with the current devstate (?), If so, and if tags are no option, this would be the way to go.
-
I don't understand what's the question means ?? When you upload an image to a field with 3 defined crop settings, there will be created 3 default crops. So there ever is a crop present, but not a manually user defined one. ?? You can do everything with it what you can do with the regular pw core imagefield. (The CropabbleImge is an extended PW core imagefield) $image->url; $image->width(500)->url; $image->size(300, 400, ['sharpening' => 'medium', 'quality' => 85])->url; Thanks for pointing me to this!
-
Hi @iipa, after (re)naming the cropsettings lowercase [a-z0-9], the issue is gone, or not?
-
@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.)
-
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.
-
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. :)
-
That would be nice: this -> "works if JavaScript is disabled" But how long will it take until all other browsers support it too? ;-)
-
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 }
-
Not sure, but maybe you are missing an ->add with the $page->$file_field ??
-
Handling special cases: The elusive navigation menu override
horst replied to MoritzLost's topic in Tutorials
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. -
Handling special cases: The elusive navigation menu override
horst replied to MoritzLost's topic in Tutorials
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. -
Really like what I‘m reading here. ?❤️
-
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.
-
This looks good! Will try it in the afternoon. Many thanks. ?
-
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. :)
-
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. (?)
- 4 replies
-
- 1
-
-
- ckeditor
- microsoft word
-
(and 1 more)
Tagged with:
-
@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.