Jump to content

jonatan

Members
  • Posts

    90
  • Joined

  • Last visited

Posts posted by jonatan

  1. Repost from Autosmush topic:

     

     

     In regards to .webp if anyone should be interested: 

    If you're using Cloudflare free plan, it doesn't matter anyway. Cloudflare free plan doesn't support HTTP vary header so this :

     

    Spoiler

     

    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.jpg -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.jpg [R=307,L]
    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.png -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.png [R=307,L]
    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.-autosmush.png -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.-autosmush.png [R=307,L]

    and 

     

    
    if($page->template != 'admin') {
      $wire->addHookAfter('Pageimage::url', function($event) {
        static $n = 0;
        if(++$n === 1) $event->return = $event->object->webp()->url();
        $n--;
      });
    }

     

    – Will NOT do anything useful. Because Cloudflare will serve your webp version NO MATTER WHAT. Which means that Safari on Mac and all iOS devices will not show any pictures... ? 

    Source: https://community.cloudflare.com/t/cloudflare-cdn-cache-to-support-http-vary-header/160802 , https://community.cloudflare.com/t/cloudflare-displays-broken-images-on-my-website/183212/13

    • Thanks 1
  2. Update in regards to webp if anyone should be interested: 

    If you're using Cloudflare free plan, it doesn't matter anyway. Cloudflare free plan doesn't support HTTP vary header so this :

     

    Spoiler

     

    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.jpg -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.jpg [R=307,L]
    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.png -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.png [R=307,L]
    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.-autosmush.png -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.-autosmush.png [R=307,L]

    and 

     

    
    if($page->template != 'admin') {
      $wire->addHookAfter('Pageimage::url', function($event) {
        static $n = 0;
        if(++$n === 1) $event->return = $event->object->webp()->url();
        $n--;
      });
    }

     

    – Will NOT do anything useful. Because Cloudflare will serve your webp version NO MATTER WHAT. Which means that Safari on Mac and all iOS devices will not show any pictures... ? 

    Source: https://community.cloudflare.com/t/cloudflare-cdn-cache-to-support-http-vary-header/160802 , https://community.cloudflare.com/t/cloudflare-displays-broken-images-on-my-website/183212/13

    • Like 1
  3. Hi! 

    So..

    If I follow this https://processwire.com/blog/posts/webp-images-and-more/  Strategy 2:

    Spoiler

     

    Delivering WEBP and automatically falling back to JPG/PNG

    
    # Output WEBP image URLs from ProcessWire, but redirect them to the
    # JPEG or PNG when the browser does not support WEBP.
    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.jpg -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.jpg [R=307,L]
    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.png -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.png [R=307,L]
    

    site/ready.php:

    
    if($page->template != 'admin') {
      $wire->addHookAfter('Pageimage::url', function($event) {
        static $n = 0;
        if(++$n === 1) $event->return = $event->object->webp()->url();
        $n--;
      });
    }

    Then all images where I call them using:

    img->width(x)->url

    I get a fine working .webp version.

    But on all images that I call using

    img->url

    It doesn't work. I get a 404 saying: https://mydomain.com/site/assets/files/xxxx/image-file-name.-autosmush.webp doesn't exist. And that's true. The automatic webp generation seems to generate a .webp verison for every size version of the image, except the one called image-file-name.-autosmush.png, meaning it looks like this in my versions overview of an image file:

    Spoiler

    image-file-name.png                              Original 
    image-file-name.webp                           WEBP of above (67%)

    image-file-name.260x0.png                  API-generated variation    
    image-file-name.260x0.webp               WEBP of above (56%)
     
    image-file-name.300x0.png                  API-generated variation   
    image-file-name.300x0.webp               WEBP of above (63%)

    image-file-name.-autosmush.png        API-generated variation
    (no webp version of this!)

    I guess it's supposed to still work even though I'm not calling a specific size trough the API? right?

    I tried this:

    Spoiler
    
    RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.-autosmush.png -f
    RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.-autosmush.png [R=307,L]

    – But that doesn't seem to do anything...

     

    Best,
    Jonatan.

  4. 1 minute ago, Robin S said:

    FYI, you can disable trash for non-superusers in the ProcessPageList module settings: https://processwire.com/blog/posts/processwire-3.0.107-core-updates/#trash-for-all

    Thanks @Robin S! I know and that's exactly the feature I had activated.. ? I wanted the non-superusers to be able to trash items, but not be able to see the "TRASH" page... But then again when I think about it know I guess it's perhaps stupid to have the ability to trash pages but not see the trash....?

    The reason why was that I just wanted to make it easy for them to "bulk delete" a lot of pages... Or not really bulk but at least only having to hover over the page > ">" > "TRASH" which is easier than "EDIT" > "DELETE"(tab) > confirm > save.

    And I guess I thought it to be easier for them / more user-friendly if they wouldn't be bothered with seeing the pages they've just trashed. But well then again I guess it's useful to see the trash if you delete something by accident

  5. 8 minutes ago, dragan said:

    A long shot, but... if you open Adminer or phpMyAdmin, what does it show in the table "templates" for id 2?

    afaik, useRoles should be set to 1, and noGlobal set to 1 too (the rest shouldn't matter).

    Replacing the wire folder won't help, cause the changes you made are stored in the DB (and even if it would be stored to the file-system, it would under site/).

    But thanks a thousand times though for the extremely quick S.O.S response @dragan !!! ❤️ Lots of love from here!

    • Like 1
  6. So.. for anyone else being as stupid as I:

    VERY luckily I had a previous .sql database export from when I moved from dev to prod site!

    So I exported the current site's db and compared the two .sql files.

    1330671675_Skrmbillede2020-10-02kl_19_35_34.thumb.png.40d5c28e455d9be0bdf93364a631131d.png

    And I noticed this difference.

    INSERT INTO `fieldgroups_fields` (`fieldgroups_id`, `fields_id`, `sort`, `data`) VALUES
    (2, 2, 1, NULL)

    I changed '{\"flagsAdd\":32}' back to NULL. Anddd ... drumrolll..... 

    192853867_Skrmbillede2020-10-02kl_19_37_59.thumb.png.039c7109c4bcafd3fc070ecccebde761.png

     

    Back was my beautiful AdminThemeBoss dearly beloved and missed PW adminarea loginscreen!

     

    (Sorry for the inconvience and S.O.S signals... But you know.. maybe someone else will be as idiotic as me one day and find this useful?)

     

    • Like 1
  7. So... I thought (for some stupid reason I can't even recall now no wait now I remember.. I wanted to hide the "Trash" for "editor" role users) that it'd be super duper smart to "Enable access control" for the field "process" on the admin template.... Really really stupid.... Now all I get is:

    528107441_Skrmbillede2020-10-02kl_19_10_55.thumb.png.d56ff4223eafd353e5d671092c20acf8.png

     

     

     

    – when I go to mywebsitedomain.com/admin

    but.... my website domain.com and all its subpages works perfectly fine! So it's ONLY the /admin (processwire) which throws a 503 at me. 

    ??☠️???

    S.O.S.

  8. Hi @Peter Falkenberg Brown ?

    Yup, on the template on which you want the new children of it that are created to skip the name field page you have to go to Family > Allowed template(s) for children and select the templates which should be allowed for the children of it. Now below it a new option "Name format for children" should appear. If you enter "title" (without quotation marks) here the new children created for this page will skip the "name field part" and automatically be named after the title field of the page once saved ? 

     

    Hope that helps ?

    Best,
    Jonatan.

    • Like 1
  9. "Permission “page-sort” for template “ ... ” not allowed (requires “page-edit” permission)"


    – This lovely error message is thrown at me, if, as implied by it, I try to add (to my "editor" role) the permission "page-sort" for a specific template, without the permission "page-edit" enabled for the same template.

    Seems like it's been mentioned a few times before but never properly answered, by e.g. @Robin S ... :  

    "Allow the granting of page-sort permission independent of page-edit"https://github.com/processwire/processwire-requests/issues/29
     

     

     



    Why do I wanna do this?:

    I have a page tree structure  ?  as so:

    ________________________

    Category [C1]

    • – Page a [C1_p]
    • – Page b [C1_p]

    Different category [C2]

    • – Page c [C2_p]
    • – Page d [C2_p]

    ________________________


    The page "Category" has the page-template "C1",
    the pages "Page a" and "Page b" both have the page-template "C1_p".

    The page "Different category" has the page-template "C2"
    the pages "Page c" and "Page d" both have the page-template "C2_p".

     

    The two pages called "Category" and "Different category" do not have any content, they only serve as containers for pages belonging to that category.

     

    I want my "editor" role not to be able to do anything at all with these pages "Category" and "Different category"; i.e. I do not want my editor to be able to edit, move, unpublish, hide, lock, delete (or do anything else to) these category pages. 
    – So, I want my "editor" role to have the "page-edit" permission for pages with the templates "C1_p" and "C2_p", but not for the pages with the category templates "C1" and "C2",

    Also, I want my "editor" role to be able to move the pages with the templates "C1_p" and "C2_p" within their parent-pages. 


    Problem:

    But if I just simply add the "page-edit" and the "page-move" permissions for the "C1_p" and "C2_p" templates, then, using the "editor" role, I am not able to move these "C1_p" (and "C2_p") -template-based pages. I can actually click "MOVE" next to them and then move them, but... then I will be met by the error message "You do not have permission to sort pages using this parent - /Category/".  
    – So, I try to add the "page-sort" (description: "permission to sort child pages") permission to the "C1" and "C2" templates... but then trying to do so I am met by the initially mentioned error message   ! Permission “page-sort” for template “C1” not allowed (requires “page-edit” permission)  

    And, as mentioned, I do not want my editor role users to be able to edit these category ("C1" and "C2") pages...

    – what to do about this? ? 

     

    All the best,
    Jonatan 

  10. @teppo Really great to get a lot of different perspectives on it! ? 

    Really nice and well-argumented opinion! It's always funny to once again discover how differently we all perceive the world and how aesthetics comes down to being something so very subjective, as you also write yourself! ? I will agree with you in fact on a lot of things that you point out about the Kirby UI, but I still think it could be really interesting to have the discussion here on the forum about the PW UI. Maybe some cool redesign ideas could pop up? And maybe it could be really interesting to hear some feedback on the UI from clients of PW designers / developers ? 

    • Like 1
  11. Well now we're suddenly number 2....

    We've been overhauled by Kirby! 

    Kirby does seem super duper sexy though. 

    The high level of flexibility and easy customization does seem quite PW like... But Kirby costs 99 euro per website... 

    Some big guys like Harvard, NYT, Smaszhing mag, Philips and Mercedes Benz are using it... 

    I think one of the main reasons people would go with it over PW is its very very sleek and sexy looking design. It's very appealing to the creative designer types (like myself). 

    PW looks more old-school, developer oriented and technical, branding and UI-wise, compared to Kirby. 

    I think we could really win a lot of new PW users if the design was more appealing. What do you guys think? 

    Personally I really really don't like the PW CMS UI colour scheme. It seems outdated and not contemporary enough. I always use AdminThemeBoss and in my opinion it makes PW look sooooooo much more sexy, appealing, user friendly and gives a better overview. 

    Should it be on the PW roadmap looking at Kirby and alike and make the PW UI more sexy / more contemporary looking per default? 

    Oh yeah, and also it's flatfile making switching between dev and production so much easier. Maybe a flatfile db option should also be a future key sales point for PW? 

    Best, 

    Jonatan 

    Screenshot_20200606_035051.thumb.jpg.7b1f59a3f704c1be4260db7b855217c0.jpgScreenshot_20200606_035127.thumb.jpg.17269b0660a8796919c988279924211a.jpgScreenshot_20200606_035108.thumb.jpg.f652a5caa6c10aeeda81de8bb90b4984.jpg

    Screenshot_20200606_035142.jpg

    • Like 1
×
×
  • Create New...