Jump to content

horst

PW-Moderators
  • Posts

    4,088
  • Joined

  • Last visited

  • Days Won

    88

Everything posted by horst

  1. I like your post and what you have said. But here, the situation seems to be a bit difficult. Have you read the more than 50 posts that the cssabc123 user has posted here in the last 5 days? I remember moments when I came to the forums and have had a look to the "Recent Posts" Box that was full with only his posts. I understand this box as a way to get quick recognition, what is useful for new announcements or people who need "emergency" help. I can't remember a time where only one person has flooded it completly alone. (And there were times where I was online every day here)
  2. @LostKobrakai, yes its definetly clumpsy, it is a solution from my early PW days where I wasn't able to inject buttons into the admin and I believe the ready.php wasn't introduced. Your code is the perfect, none-clumpsy addition to the bootstrap-sorting-script.
  3. Hi Hanna, I have used another approach on a site with many images where the user want his images sorted in alphabetical order only initially, but want to be able to reorder them manually later on a bit. Maybe this sounds a bit clumpsy now, but we have added a link for the imagesorting to the frontpage only for superusers or imageauthors, like with the common edit-this-page link in PW's default site-profiles: if ($page->editable()) { // add edit link(s) to it, if the current user has edit rights $s .= "<li class='left'><a id='editpage' title='diese Seite bearbeiten' href='" . wire('config')->urls->admin . "page/edit/?id={$page->id}'><i class='fa fa-edit fa-lg'></i></a></li>\n"; if ('gallery' == $page->template) { // add an imagesort-link to it, if it is a gallery page $s .= "<li class='left'><a id='editpageSortimages' onclick=\"return areUreallySure('Bilder für dieses Archiv ({$page->archivnummer}) jetzt alphabetisch sortieren?');\" title='sortiere Bilder alphabetisch' href='/pwSortPageimages.php?id={$page->id}'><i class='fa fa-sort-alpha-asc'></i></a></li>\n"; } } So, from the backend the user has to click on the view button first, then in frontend click the sort-my-images button, which calls the following bootstrap-script which resides in the pw root (pwSortPageimages.php): <?php // define userroles that are allowed to work with this script, like: superuser|editor|author $userRolesSelector = 'superuser|publisher|author'; //-------------------------------------------------------------------------------------------// // check if we have got an id $pageId = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : false; if (false===$pageId) { header('HTTP/1.1 403 Forbidden'); exit(3); } // bootstrap PW require_once(dirname(__FILE__) . '/index.php'); // check user-account $validUser = false; $roles = explode('|', $userRolesSelector); foreach($roles as $role) { if (wire('user')->hasRole($role)) $validUser = true; } if (!$validUser) { header('HTTP/1.1 403 Forbidden'); exit(2); } // check if id points to a valid page $p = wire('pages')->get($pageId); if ($p->id != $pageId || 'gallery' != $p->template) { // check for a valid page id and also if the template matches the a gallery page header('HTTP/1.1 403 Forbidden'); exit(1); } // now we reset the order for the images field (change the name of your field if it is not named: images) $p->of(false); $p->images->sort('name'); $p->save(); // and redirect to the page edit screen $url = wire('pages')->get(2)->url . "page/edit/?id=$pageId"; header("location: $url"); exit(0); This way the user has to click two times more if he want to sort his images in alphabetical order, but it gets only triggered on demand, plus the user can reorder them afterwards. The link to start the sorting can also be injected into the admin-editscreen, what would be a bit nicer and saves one click.
  4. also here!
  5. Thanks for reporting this and the part reported by @Juergen.
  6. PHP 7 ? (just kidding)
  7. I have two questions: What PHP version do you use on that server? and: Why do you use this format with double-qoutes wrapped with single-quotes? '"50%,40%"' or: Have you also tried it with only one of them, (only single-quotes and / or only double-quotes)?
  8. Hi Gideon So, unfortunately I haven't followed / used the Image Manager project since a long time. But in the meantime there was an EXIF-module contribution from @nico. Maybe this is of help for you: http://modules.processwire.com/modules/image-exif/ It adds an EXIF property to the image API call and let you retrieve all sort of EXIF informations.
  9. For me it is also not working. I have changed it to: protected $_pathToTemplates = '/templates/'; This is also working under windows. The \ (backslash) in windows only is necessary if you execute shell commands. Otherwise the forwardslashes are converted magically by PHP. See also: http://php.net/manual/en/dir.constants.php or here: http://alanhogan.com/tips/php/directory-separator-not-necessary
  10. @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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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/ . .
  16. 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 ?
  17. 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.
  18. 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.
      • 7
      • Like
  19. 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?)
  20. 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.
  21. @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.
  22. Here is another nice one: http://vollkorn-typeface.com/
      • 3
      • Like
  23. 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?
  24. 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 _ ??
×
×
  • Create New...