Jump to content

Peter Knight

Members
  • Posts

    1,374
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Peter Knight

  1. I am trying to assign an incremental number to each image starting from 0 

    <li uk-slideshow-item="0"><img src="images/photo.jpg"></li>
    <li uk-slideshow-item="1"><img src="images/dark.jpg"></li>
    <li uk-slideshow-item="2"><img src="images/light.jpg"></li>

    The API docs mention I can use the following

    Quote
    
    $a->eq($n)

    But when I apply it below, I get the following error

     Method Pageimage::eq does not exist or is not callable in this context 

    Here's my usage

    foreach($item->images as $photo){
    echo "
    <li uk-slideshow-item='{$photo->eq($n)}'><a href='#'><img src='{$photo->size(150,100)->url}'  alt=''></a></li>
    ";}

    Thanks again

    P

  2. I have 2 repeater types working with the Repeater Matrix.

    To keep things simple, I have

    1. image gallery
    2. a downloads gallery.

    I can't quite figure out how to echo the contents from within a product_gallery. 

    I can get the code below to display the text 'An image gallery' but not the bunch of images within this.

    I'm not sure though if it's my variable trail or my nested echo statement.

     

    <?php
    foreach($page->components as $item) {
      if($item->type == 'product_gallery') {
        echo " An image gallery...";
    
            foreach($product_gallery->images as $photo) {
            echo "
    	An image
    	<image src='{$photo->url}'>
            ";
                }
        }
           
    
    
        else if($item->type == 'downloads') {
            echo "
             A download gallery...
              ";
         
        }
    }
    ?>

    Thanks

    P

  3. 15 minutes ago, Autofahrn said:

    For me removing the uk-width-expand from the inner div (the one with class=' uk-width-1-1@s uk-width-1-2@m uk-width-4-6@l uk-width-expand pk-col-bod') seems to fix it (not verified other aspects of the layout). But I won't consider a width of 1700 pixels to be a quite big resolution nowadays.

    amoss-ie.thumb.jpg.c381745f4f248c50f3b65ce406744dd7.jpg

    Agreed. I just need to add some custom widths to the pk-col-bod to make it mimic the previous layout etc.

    • Like 1
  4. 1 hour ago, Tom. said:

    Hi @Peter Knight

    Change uk-width-expand to uk-width-1-1

    IE11 has some strange bugs with flex - I believe the issue is with flex: 1 and max-width, it's respecting both but it's treating it like space-between. For whatever reason, I don't know. As you have a max-width defined in this instance uk-width-1-1 will work fine. 

    Thanks Tom. That largely works ok. I've yet to test it fully.

    The tricky part here is that the layouts across the site are using bespoke widths and stepping outside the normal UIKit columns widths etc.

    But that's a huge help and seems promising enough to start testing from. 

     

    • Like 1
  5.  

    Hi guys

    I know some of you are UIKit fans like me. I built a site recently using UIKit 3 and I'm having some layout issues on IE 11 and largest breakpoints.

    You have to set quite a big resolution or have a large monitor to experience this as it only happens on largest breakpoints.

    The main column in the above URL is successfully centered in most browsers except IE11.

    On IE 11, it shifts to the right. Basically it's a DIV using the uk-width-expand selector and then I have a custom max width and a margin in there to centre the content horizontally.

    Here's a simple CodeKit and JSFiddle of the issue

    https://codepen.io/edenstudios/pen/qvWpGo

    https://jsfiddle.net/EdenSt/auekfgqt/8/

    Thanks
    P

     

     

  6. This is probably more a server issue with Plesk etc but relates to Processwire.

    I have a very long web form which takes the average user 3-5 minutes to complete. I know it's crazy but it's a client-driven thing.

    Occasionally, my client has been emailed by users that when they eventually his Submit, they get a general 500 server error.

    I did some research and looked at some logs and it seems to be some type of time-out issue. I guess that makes sense if the form takes minutes to complete as the first two fields of the web form are attachment uploads. I'm thinking that attaching files establishes some type of session but that session expires by the time the web form is actually submitted.

    Does that sound plausible enough?

    I plan to suggest moving the attachment fields to the end of the email, disabling the webform CSFR too and seeing if things improve.

    Does my theory about file uploads and session time outs sound plausible?

     

  7. Idea: A way to push/pull or simply copy an image from Images field 01 to Images field 02 (or vice versa).

    I primarily need this for two image fields on the same page but I imagine some would find it useful for 2 images fields on different pages.

    Use Case

    Client has a general images field on every page of their site with all the images they need.

    We now need to create a second images field dedicated to a particular type of image.

    This image is based on an image already in the first images field. 

    Being able to push/pull/copy would save them a heap or re-uploading etc

     

    I understand the flexibility of image tagging, croppingm using first() etc etc but we genuinley need a second images field and for it to be quicker (than re-uploading) to duplicate an image into this second field.

     

     

     

     

  8. I'm getting this too

    Quote

    Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '41-0' for key 'PRIMARY' (in /var/www/vhosts/domain.com/httpdocs/wire/core/FieldtypeMulti.php line 295) 

     

    I have notifications turned on too. I wonder has @ryan any advice here if it is notifications. It's hard to replicate.

  9. I was having some issues logging into a site with PageProtector turned on using Chrome on Android. My users would hit login and either nothing would happen. occasionally, a 500 error would be displayed.

    In the end, I transpired that a setting called 'Data Saver' was enabled. Once you disable this, my logins worked.

    Alternatively, you can run your site over HTTPS to bypass this. I've yet to try it but if you're logging into sites etc then HTTPs should be the default anyway ?

     

  10. 53 minutes ago, LostKobrakai said:

    Reverse the second part?

    After trying various sort and reverse options, I saw you post, tried again and it's perfect now ?

    $does2 = $page->prevAll("template=a-practice-area")->reverse();
    foreach($does2 as $do2)

     

  11. 1 hour ago, LostKobrakai said:

    Why would there if you need a "current" page to be able to do all of that?

    You're right - thank you.

    So I adapted my code to use page instead of pages and this modfied version works

     $items = $page->nextAll('template=a-practice-area');
    foreach($items as $item) {
    echo "

    IE if you were on page 4, the output is
    5,6,7

    Is there a method to restart  the array after it reaches the end so that the output is

    5,6,7,1,2,3,4

     

  12. I have a selector which is pretty simple and just fetches a series of pages except for the current page.

    1,2,3,4,5,6,7

    When you're on page 1, the output is
    2,3,4,5,6,7

    When you're on page 2, the output is
    1,3,4,5,6,7

    $services=$pages->find("template=a-practice-area, id!=$page, sort=sort "); 
    foreach($services as $service) {
    echo "
    <div>...

     

    Currently, the array (is that what it's called? starts from the first item (service) in the tree and continues.

    I'd now like to start the array from the next item in the array instead always starting at the first.

    IE if you were on page 2, the output is
    3,4,5,6

    IE if you were on page 4, the output is
    5,6,7

    Looking at the docs, a selector called 'start' is mentioned.

    Quote

    That selector tells ProcessWire to return 50 (or fewer) results. The starting result is always the first, unless you use the "start" reserved word, i.e.

    
    start=50, limit=50
    2

    I think this is what I need and have tried the following to no avail

    <?php $services=$pages->find("template=a-practice-area, id!=$page, sort=sort, start=$page"); 

    Any tips?

     

     

     

  13. 22 minutes ago, Autofahrn said:

    Probably totally stupid question, but do the user-uploaded images go through PW-side image processing at all?

    I have some width and height restrictions on my images field so the image gets uploaded and resized. In this case I'd assume anything specified in the 

    Quote
    
    $config->imageSizerOptions = array(

    gets applied. But i'm only guessing.

    • Like 1
  14. Is there a way to make JPGs progressive by default via the API?

    I've added the following to my site/config.php file but user-uploaded images are often displayed as non progressive.

    $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)
    	);

    Thanks

×
×
  • Create New...