Jump to content

Marty Walker

Members
  • Posts

    629
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Marty Walker

  1. Hi Horst,

    I'm having an issue when I upload an image (I'm running PW 2.5.18) which doesn't give me the initial crop. Instead I get a scaled down version of the full image. If I attempt to make a crop I get a larger version of the crop I just made.

    Edit: When I rolled my install back to 2.5.17 it functioned correctly again.

    Screen-Shot-2015-02-09-12-54-28.png

  2. Hi,

    I'm using @soma's code below fine. How would I do a check so that I can only output images under a certain width or height? My attempt in bold.

    <?php
    function renderItem($pa) {
        $out = "<li>";
        $out .= "{$pa->title}<a href='{$pa->url}'><img src='".$pa->portfolio_images->first()->getCrop('thumbnail', "quality=65")->url . "' alt=''></a>\n";
        $out .= "</li>";
        return $out;
    }
    
    $limit = 32;
    $artist_images = new PageArray();
    $artists = $pages->find("template=portfolio, portfolio_images.count>0, limit=$limit, sort=random");
    $found = $artists->count();
    
    foreach($artists as $artist_images){
    	if($artist_images->portfolio_images->width < '1200' XOR $artist_images->portfolio_images->height < '1200') {
    	    echo renderItem($artist_images);
    	}
    }
    if($found < $limit){
        while($found < $limit){
            $rp = $artists->getRandom();
            echo renderItem($rp);
            $found++;
        }
    }
    
    

    A more cleaned up code example: smile.png
     

    function renderItem($pa) {
        $out = "<a href='{$pa->url}'>";
        $out .= "<img src='{$pa->images->getRandom()->size(180,180)->url}' height='150' width='150'/>";
        $out .= "</a>";
        return $out;
    }
    
    $limit = 10;
    $bilder = new PageArray();
    $seiten = $pages->find("template=basic-page, images.count>0, limit=$limit, sort=random");
    $found = $seiten->count();
    
    foreach($seiten as $bild){
        echo renderItem($bild);
    }
    if($found < $limit){
        while($found < $limit){
            $rp = $seiten->getRandom();
            echo renderItem($rp);
            $found++;
        }
    }
  3. Hi,

    I'm not even sure how to ask this question technically so here goes. I'm working on a home page that'll have a grid of images like this:

    Screen-Shot-2014-11-24-12-25-01.png

    But every so often I need to remove two of those images and replace it with an image twice the width and in a certain place, like this:

    Screen-Shot-2014-11-24-12-25-10.png

    Any pointers? Many thanks. - Marty

  4. I've been inlining media queries in my LESS files (I haven't gotten around to using SASS yet, and because of AIOM) for a while now. As you say the CSS is a mess but I'm OK with that.

    I usually have a variable at the top of my LESS file:

    @mobile:  ~"handheld, only screen and (max-width: 767px)";
    

    When I need to use it:

    foo {
    	margin-bottom: 3rem;
    	@media @mobile {
    		margin-bottom: 20rem;
    	}
    }
    

    If I find myself needing more breakpoints I just add a variable with a different max-width.

    • Like 2
×
×
  • Create New...