Jump to content

Peter Knight

Members
  • Posts

    1,374
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Peter Knight

  1. Anyone tried to enable interlacing on their JPGs via the site/config.php?

    I've tried it on 2 sites now and never seemed to kick in. Cache cleared etc.

    I'm expecting to see a low-quality blurry JPG first and each pass improves this.

     

    $config->imageSizerOptions = array(
    	'upscaling' => true, // upscale if necessary to reach target size?
    	'cropping' => true, // crop if necessary to reach target size?
    	'autoRotation' => true, // automatically correct orientation?
    	'interlace' => true, // use interlaced JPEGs by default? (recommended)
    	'sharpening' => 'soft', // sharpening: none | soft | medium | strong
    	'quality' => 95, // quality: 1-100 where higher is better but bigger
    	'hidpiQuality' => 60, // Same as above quality setting, but specific to hidpi images
    	'defaultGamma' => 0.5, // defaultGamma: 0.5 to 4.0 or -1 to disable gamma correction (default=2.0)
    	);

     

  2. On 4/6/2017 at 12:43 AM, Vikestart said:

    Setting the defaultGamma option to 0.5 instead of the default 2.0 seems to have fixed the image quality.

    
    $config->imageSizerOptions = array('upscaling' => true, 'cropping' => true, 'quality' => 100, 'sharpening' => 'none', 'defaultGamma' => 0.5);

    Thanks for the help everyone! :D

    @Vikestart

    Did you paste this from your config in /wire/ to your config file in /site/ ?

  3. Someone suggested that an easy way to output a random image from a field was to use getRandom and then simply use limit=1

    I'm not sure where I apply it to the following

    <?php
    $randomitem = $pages->get(1034)->images->getRandom();
    foreach($randomitem as $item) {
    echo "
    <img src='{$item->url}' class='squares'>
    
    ";} 
    
    ?>

    Does it go at the start where I define my variable or somewhere in the echo statment?

    Thanks

  4. 10 minutes ago, adrian said:

    That's basically what is going on with Page Protector already so I don't see how it will help.

    If they reload the page and it churns for 30 seconds then I think there is something else going on. There are mod_fcgid settings that can be tweaked but as I mentioned above I tried for ages and never got anywhere. I think there is something between PW and nginx as a proxy for apache, but I couldn't figure out what it was. All the issues i had (which sound similar to yours) went away when I changed to a pure apache server (not FastCGI). Maybe others have been down this road and got things working. BTW - I didn't have PageProtector enabled and still had issues.

     

    Good to know - thanks.

    Do you mean choose option 2 below?

    • FastCGI application served by Apache
    • FPM application served by Apache
    • FPM application served by nginx
  5. 1 hour ago, LuisM said:

    You could try something quick and dirty in your template file.

    Before any output check if the $user is logged in on every request and redirect him to the same page if not. This should trigger your login I guess

    
    <?php 
    if(!$user->isLoggedin()){
     $session->redirect($page->url) 
    }
    ?>

     

    That's not a bad idea assuming I remove it before we go live with the site.

    I'll just check with @adrian that this is compatible with his page protector ?

  6. 7 minutes ago, adrian said:

    Do you mean browse on frontend, or try to access page editing in the backend? The backend issue is normal PW behavior when a session has expire. I guess because you are using Page Protector it's causing the same issue on the frontend.

    Perhaps the login persist module might help: http://modules.processwire.com/modules/login-persist/

     

    They are often logged into the site under PageProtector to view the front end AND  logged in via /processwire/ too.

    Isn't there a way that a user can be kicked back into the pageprotector login screen if their session has expired?

     

  7. 13 minutes ago, dragan said:

    Your mySQL version is fairly recent; I don't think that has anything to do with your problems.

    if you have Tracy Debugger installed, you can var_dump($config), then search for anything session-related.

    You can adjust session lifetime in site/config.php (my sessionExpireSeconds is set to 86400 seconds = 24 hours = default)
    https://processwire.com/api/ref/config/#pwapi-methods-session

    The SessionHandlerDB module is in the core since some time: https://processwire.com/blog/posts/pw-3.0.103/#new-feature-in-session-database-core-module

     

    Thanks. 

    I've added the sessionExpireSeconds to my config. There was nothing in place regarding this previously.

    I also enabled the Module Session Handler Database and had a PHP warning within processwire as follows

    Quote

     Your PHP has a configuration error with regard to sessions. It is configured to never clean up old... 28 secs 

    Your PHP has a configuration error with regard to sessions. It is configured to never clean up old session files. Please correct this by adding the following to your /site/config.php file: ini_set('session.gc_probability', 1);

    I'm going to add that ini_set and hope it helps.

  8. I appreciate it could be a lot of things.

    3 hours ago, dragan said:
    • What mySQL version do you use?
    • Do you use DB- or file-based sessions?
    • Do you use https at all?

    I've seen a few other PW threads that had similar error messages... could be plenty of stuff involved o_O

    1. I'm using 5.5.60
    2. Not sure
    3. Not yet but we will be when the site goes live

    I think what's happening here is as follows.

    1. Client logs in via page protector to their site
    2. While browsing the site they leave a tab open and go into meetings etc
    3. They come back 15 mins later and their session has expired
    4. They try to browse the site but as their session has expired, they get a spinning / loading thing

     

    Does that sound like a plausible explanation? And if so, is there a way to extend someone's Processwire session cookie for an hour or so?

    P

     

  9. I have a demo site which I moved to a new VPS for client testing

    We noticed that leaving a page open and then revisiting the site can result in a 25 second(ish) to load time and will then throw a 500 Error.

    The hosting guys had a look and confirmed that the server is fine but the issue could be related to authentication or sessions.

    We are running Page Protector and ProCache so I wondered if there were any known bugs here and any recommended actions.

    My actual PW log doesn't show anything but the server log has plenty of these

     

    2018-12-06 08:14:00 Error xxx.141.1x.101 500 POST /who-we-are/ HTTP/1.0     1.58 K Apache access
    2018-12-06 08:14:45 Warning xxx.141.1x.131   mod_fcgid: read data timeout in 45 seconds, referer: http://demo.abc.not/who-we-are/       Apache error
    2018-12-06 08:14:45 Error xxx.141.1x.131   End of script output before headers: index.php, referer: http://demo.abc.not/who-we-are/       Apache error
    2018-12-06 09:03:18 Error xxx.141.1x.131   2614#0: *667 recv() failed (104: Connection reset by peer) while reading response header from upstream       nginx error

    Thanks

    P

  10. 8 hours ago, horst said:

    @Peter Knight, please can you try the following fix manually on your side?

    In the file site/modules/CroppableImage3/ProcessCroppableImage3/ProcessCroppableImage3.module on the lines 234 & 235 you must remove the wrapping isset(...) on each first checked param per line!

     

    Thanks @horst
    that worked. 

    When I set sharpening to none, it was reflected on the final save window.

    I'm still getting a slight pixelation on the source jpg but it's probably non Module related. It's hardly noticeable but would be keen to hear if you think it could be.

     

    • Like 1
  11. On 11/16/2018 at 11:16 AM, Tom. said:

    I believe that ProcessWire automatically sorts out duplicates so you could do

    
    $Cats = $pages->find("parent=1086, id!=$page, sort=sort");
    $Cats->prepend( $Cats->eq(4) );
    
    foreach($Cats as $Cat) {
    }

     

    Hi Tom

    Thanks for this.

    I had unexpected results with this and I think I know why.

    My array consists of 4 items (Categories) so 

    $Cats->prepend( $Cats->eq(4) );

    works until I hide the current Category. Essentially this means the array only consists of 3 Categories and the page throws an error.

    That's only my guess. If I do $Cats->eq(3) etc or a lower number it works.

    On 11/15/2018 at 9:24 PM, Robin S said:

    Alternatively here is a more flexible approach that you can use for any item in the WireArray:

    2018-11-16_102130.png.0fa824632484d52531ec24822d0a02b8.png

     

    Worked for me. Thanks @Robin S

  12. Hi

    I have a page reference field which are a series of checkboxes in the back end

    • Web Design
    • Web Development
    • Marketing
    • Administration

    In my template I was previously listing only 1 key skill at a time but now I need to output each checked item separated by a comma

    IE

    Marketing, Administration

    This does work but echoes 

    Marketing, Administration,

     foreach
                            ($staff->skills as $item){
                            echo "{$item->title},";}

    How would I keep the comma from appearing at the end of the last item?

    Thanks

  13. Hi Horst

    Possible bug...

    When I'm in the popup window which displays the crop preview, there's a sharpening dropdown. If I select None as the sharpening value, the next screen (the Save screen) lists the sharpening as Soft.

    It also does this when I set the sharpening to Strong. I haven't checked the others (Medium, Hard etc)

    ProcessWire: 3.0.119
    CroppableImage3: Latest
     

  14. 1 hour ago, horst said:

    @Peter Knight why do you cannot sort the pages manually, or let the client sort them manually?

    I can't sort them manually because the order is used in other layout components across the site.

    Technically I could build an extra kind of sortable page list but I also want to keep this really simple for a client who will be maintaining the site.

     

    • Like 1
  15. <?php 
    $Cats=$pages->find("parent=1086, id!=$page, sort=sort"); 
    foreach($Cats as $Cat) {
    echo "

    I have a selector that pulls in 4 child pages of a parent and the order is set to reflect the order of the tree.

    My client has asked that instead of

    Cat 1 | Cat 2 | Cat 3 | Cat 4

    we instead display

    Cat 4 | Cat 1 | Cat 2 | Cat 3 

    However, I can't change the sort order in the tree.

    Can anyone guide me on the correct approach here?

    Thanks

     

  16. @bernhard No problems here

    Mac OSX and Chrome 70.0

    I sometimes get caught out by the behaviour of the tab key but just noticed why and not sure it's a bug. Pressing tab after an @name puts the focus on the 'Submit Reply' button and away from the text field. I just noticed because on Mac/Chrome the Submit Reply button gets an active colour. 

  17. Just now, bernhard said:

    DepId would be a variable of course. Listing all persons would be as easy as just "template=person"

    But maybe you have a different template setup. I thought departments have template dep and meet have template persons and persons have template person.

    Is it different?

    1

    That's the correct structure.

    I see what you mean about Depid being a variable. I'll try that.

     

  18. I can't use 

    has_parent=id because I need my output to work for 2 different pages

    Essentially I want to do this...

    • Get any child pages within a folder called "meet"

    Both Department A and Department B have their own "meet" folder and must only list the contents of their own meet folder

     

×
×
  • Create New...