-
Posts
4,077 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
@Adrian: One day later, I think the best way really would be to have an upload / import function for svg-images, where they get prepared for further usage in the module. At least this should include to check/set width and height to 100% and to inject a css-color-var. That said, you need to drop or reformat my usage with the svg-template. But I think this isn't the big part of the changes we will see! Regarding the storage of the original / source images, (DB or files), I think DB is saver. Files easier can be changed / deleted by accident. I'm very happy that you take it and bring it further. PS: I have updated the gist to version JamesBond, (0.0.7). Mainly added/corrected the presentation function, what draws nice overview charts.
-
Deployment with PHP-FPM and mod_proxy_fcgi
horst replied to Corinna Schappacher's topic in General Support
I think, than it is more useful for you, to ask this question in an apache httpd (mod_proxy_fcgi?) forum. Where / how is this mod_proxy_fcgi configured? Redirecting with GET-vars looks to me to be one of the most common things. But I have no clue about that apache module. -
Hi FreeAgent, the renderNav function only processes the items within the PageArray just in the order how you have created the PageArray. So, you don't need to change the renderNav function, you need to sort the items of the PageArray in the order you want them to be displayed. First thing is: how have you managed the order in the admin pagetree (in backend)? have you set the blog children to be sorted newest first? ("-created") If not, you I think you should set it this way and I expect that this order will be used to build the PageArray what is passed to the renderNav function. Changing the sort order for a pages children can be done by opening the relevant page for editing, selecting its children tab and go down to the field "sort settings". --- --- --- And going one step further: To ignore the selected sort order of the Admin-PageTree and to sort items of PageArrays by the API is also possible and used very often. // here you collect all children of the current page $pageArray = $page->children("sort=-created"); // here you first "get" the blog-page (the parent / rootparent of all blog entries) and then collect all of its children $pageArray = $pages->get("name=blog")->children("sort=modified"); // with the selector string you can, (besides others), also pass a param for the sorting order // "find" something different: $pageArray = $pages->find("template=news, sort=-modified"); // it is possible to sort by other things, please refer to the docs . Also useful is to refer to somas awesome cheatsheet.
-
To make it the default Theme for your site(s) is very easy: go to modules and install renotheme go to the guest user and select renotheme as the default admintheme Ready! I think, when building a new site, everyone uses his / hers individual "starting site profile" with some modules allready installed or some setting tweaks. If you do so too, you need to switch renotheme to be the default only once for the next couple of years. Besides that, my experiences are that for many less techsavy users, the default theme looks to be more cleaner (empty!). For those, I like to put everything out of the way and give them the most possible minimalism admin backend. And this is best done with the default admin theme. Another fine thing is, that you can enable both themes and give the user(s) (by roles) the choice to select / switch their default. Sorry for being a bit redundant on this.
-
Adrian, both ideas sound good. I also have thought if it would be better to only store the <path></path> part of the original icons? So, it is the first time I look into SVG. As I know, you are much more experienced with it. My initial thought was, that other devs can take the gist and build their own modules. Thats why I called it a POC. But the idea with decoupled icon files or storing the icon data into the DB sounds very good. If you like, you can take it over, or you can commit to it. If that isn't doable with gists, we can put it into a github repo. I'm very short with time atm. It was fun to play with this. But for now, my time budget is empty. If you cannot or do not want to take it over, we also can collect ideas and / or code snippets until someone has time to code it in.
-
Hi, I'm not sure if this can be useful or not. Check by your self. I have created a little module around a set of 42 svg icons. (nearly a copy from Windows 10 iconset). It is very rudimentary at the moment. One can define settings for colors and size of the svg variations. Variations will be created on demand in a central directory (assets/svgicons/) and cached for later usage. The settings can be passed as selectorstrings. You can use a template variable $icon. To output markup for a plain svg icon in an image tag, you need to call the name: echo $icon->img("name=lock"); echo $icon->img("name=unlock"); If you want use it as a rollover with hover state, you need to call the function markup: echo $icon->markup("name=attention"); This gives you markup with default settings. If you need a clickable link, just define it in the selector string: echo $icon->markup("name=attention, link=/about/"); You can set / change the default values from template like: $icon->setColors(array(0, 111, 187, 0.2), array(219, 17, 116, 1.0)); $icon->setSize(180); and / or you can use individual settings for each icon: echo $icon->markup("name=document, size=32, color1=#775599, color2=blue, link=/about/"); // HEX colors or named colors echo $icon->markup("name=idea, size=120, color1=255-255-0-0.3, color2=255-255-0-1, link=/about/"); // RGBA colors echo $icon->markup("name=home, size=20, color1=230-0-0, color2=230-0-0, link=/about/"); // RGB colors . For the rollover / hover markup there is a piece of css needed what can be outputted (only once). It can be fetched with or without the style-tags: echo $icon->css(); // with style tags echo $icon->css(true); // suppress the style tags . The functions that does not output markup return the module itself (the $icon object). So you can use them chained: // all functions that can be chained: $icon->emptyCache()->setSize(100)->setColors(array(0, 111, 187, 0.25), array(243, 79, 159)); // after such a (re)set call, you only need to pass a name to each icon call to get consistent results: echo $icon->markup("name=lock, link=/logout/"); echo $icon->markup("name=unlock, link=/login/"); // you can override single settings, ->mu() is a shortcut for ->markup() echo $icon->mu("name=trash, size=200"); echo $icon->mu("name=key, color2=red"); // ->presentation() print the whole collection with optionally individually specified size and colors: echo $icon->presentation(100, array(0, 111, 187, 0.25), array(243, 79, 159)); . . . The code is here in a gist: https://gist.github.com/horst-n/f6922f6fa228991fd686 . Download it as ZIP! . . A live demo is here: http://images.pw.nogajski.de/svg-icons/ . .
-
Deployment with PHP-FPM and mod_proxy_fcgi
horst replied to Corinna Schappacher's topic in General Support
Hi Corinna, welcome to the forums. Maybe, this has nothing to do with your problem, but want to be sure: Have you already tried this: https://processwire.com/docs/tutorials/troubleshooting-guide/page3 ? -
Where to set image resizing quality and how to re-resize images
horst replied to Adam Kiss's topic in General Support
Filetype is JPEG you said? If you change things for testing purposes, you can add a param "forceNew" => true to an options array to always override previous versions. And if you want check filesize compared to quality settings you can use the suffix setting for a complete check loop like that: $img = $page->images->first(); // grab you an image (change code to match your setup) $newWidth = ($img->width == 2500) ? 2499 : 2500; // set a width value different than the original image size! (is needed for the test only) $qualities = array(100, 90, 80, 70, 60, 50, 40, 30, 20, 10); foreach($qualities as $q) { $options = array('forceNew'=>true, 'quality'=>$q, 'upscaling'=>true, 'sharpening'=>'soft', 'suffix'=>"quality{$q}"); $variation = $img->width($newWidth, $options); echo "<p>variation: {$variation->name} :: " . filesize($variation->filename) . "</p>"; } Code is written in browser, if it doesn't work as expected, please check for typos or come back here and tell me. And if it works, please drop a note about the result. -
Hi, I have first time used and setup OPcache for a site and found a useful explanation of some aspects / setting params here: fine-tune-your-opcache-configuration-to-avoid-caching-suprises Maybe it is useful for someone else too.
-
Yes, check the access-settings on your home template, and / or check if you really have a template file present for it in directory site/templates. (Have you deleted / moved the templatefile by accident? Or have you renamed the filename?)
-
Maybe you can use Module: Session Handler Database, Don't know if it is a much better performance, but could be, as it don't need to touch filesystem. You find it under modules -> core -> "Session". There you can activate it. In this regard, it may also be useful to use this both settings for PHP in the site/config.php @ini_set("session.gc_probability", 1); @ini_set("session.gc_divisor", 100); It has to do with the session garbage collector. Maybe you can tweak those settings. But I don't know, you have to research on your own for that.
-
I need help with link pages with processwire
horst replied to AmadeuAntunes's topic in Getting Started
@Andrei: I think it is a typo, but an incorrect example may be confusing for beginners. $pages->find($selector) always returns an array, where you further need to select one item out, with e.g. ->first(), ->last() or ->eq(#). If you know that there is only one page that will match your selector, (or you only need to get the first match), you can use $pages->get($selector), which will return only a single item. -
Here is another nice one: http://vollkorn-typeface.com/
-
Aha! You need to debug what your $cta->image really holds. [ ] check if the fieldname is correct (image or images or other?) [ ] check if the image field is set to single-mode, what is [ ] put a line into your code to inspect the value (see *1) *1) foreach($page->call_to_action as $cta) { $count++; $class = ($count == 2) ? "one_half last" : "one_half"; $img = $cta->image->size(300,300); // debug $img: echo "<pre>\n\n"; var_dump($img); die('RIP :: ' . __FILE__ . ':' . __LINE__); echo "<div class='{$class}'> <a href='{$cta->call_to_action_url}' class='over'> <span>{$cta->overlay_title}</span> <p>{$cta->overlay_description}</p> </a> <a href='{$cta->call_to_action_url}'><img src='{$img->url}' /></a> </div>"; } BTW: in your code the img tag is unclosed (/>), and your code does not check if an image is really set for each repeater item. Or is the image field set to be required in the template?
-
Sorry, I don't get what you are asking for?! Can you explain a bit more what your code does or does not and what you want to be the result? Also I'm not sure, but the original image URL in the a-tag, shouldn't it be: <a href='{$cta->call_to_action->url}' ^^ = -> instead of _ ??
-
a nice one: http://whatcolourisit.scn9a.org/
-
How to import table of data into ProcessWire
horst replied to Tony Carnell's topic in General Support
There is one thing that needs a bit attention when importing data. We need to check if a record was also imported by a previous run of the script, otherwise you may end up with numerous duplicates. while($row = $result->fetch_assoc()) { $title = wire("sanitizer")->text($row['title'], array("maxLength"=>128)); // fetch and sanitize the title $p = wire('pages')->get("title={$title}"); // check if it already exists if(0 < $p->id) continue; // move on to the next record if it exists $p = new Page(); $p->template = "dam"; $p->parent = "something"; $p->title = $title; // use the sanitized title $p->save(); } -
Best information is given from the author himself in his blogpost
-
another goodie I have found a view days ago: http://www.fnordware.com/superpng/ (Source is at https://github.com/fnordware/SuperPNG)
-
... that now also lives in my Editor. - http://sourcefoundry.org/hack/ - .
-
Welcome @mauricius. This looks really awesome! PS: Best way to get early feedback is to publish a alpha- or beta-state github repo and post the link here. EDIT: PPS: yuhu, I saw & liked it first!
-
delete orphaned files/images from site/assets/files
horst replied to interrobang's topic in General Support
It depends on what PW version and third party modules you are using. If you only use the core imagesizer, you can use it with all the dis /-advantages mentioned above. This lines if ($field->type instanceof FieldtypeImage) { foreach ($file->getVariations() as $f) { fetch all valid variations that will be kept, regardless of the PW version you use. If you use the thumbnails module, this will work too. If you use the Pim 1 module this will work if you have $keepPimVariations enabled. With Pim 2 module, you don't need to enable $keepPimVariations, because Variations of Pim2 will be detected and kept by the core ->getVariations() method already. If you use other third party modules that create image variations, you need to check how they name the variations. If it matches the core naming scheme with -suffixes added to the original name or -suffixes added to a variation name, it will work. You can run the script and let the unlink() line commented the first time(s). This way you can read and check all selected filenames first, before you enable the deletion! -
Include image config settings in image variation filenames
horst replied to Robin S's topic in Wishlist & Roadmap
If you change options for image variations, you always can set "forceNew" => true, to force a recreation of the variation(s). This can be done everywhere, in line of code in a template to affect only those images, or in a module or even in site/config.php to force recreations for every variation on every page load site wide! (SO BE VERY CAREFULLY!) You can also use PIA. She has an option for that sitewide setting to switch on and off. This also only takes affect for logged in admin users, and not for page views by guest users. But I like the idea! I also have had a module (or proof of concept) that supported it, but it worked only with PW 2.4. and stopped working with all the changes on pageimage / imagesizer introduced in PW 2.5+ One minor thing: cropping is reflected in the variation names by the current core! Only upscaling, quality and sharpening is missing! -
Hi Martin, uhm yeah, the imagickSizer is very old. It doesn't work with PW versions other than PW 2.4.x There were many changes done in PW core after I have created it and I haven't found the time to write a new one. Also there is an issue with transparent and / or indexed PNGs with IMagick that makes it very uncomfortable because exactly some issues with transparent PNGs in GD was the most annoying point why we once have started to build this as an alternative!