Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • I’m looking for this exact functionality. Did you find anything that met your needs? This plugin is great but I want to have a pool of six or so images to randomly assign, not just the one!

    @fidosysop your permalink fix worked like a charm, as my site only had a few pages. I hope this doesn’t affect eCommerce sites!

    I’m attempting the exact same thing as you, and we both stumbled across the same fixes! (Sure wish I found this thread earlier.) I seem to get 403 errors when trying to access the upload directory, though. Both in the default dir and in any new path I define. Originally I thought it could be solved by simple permissions, but even with those set to 777 as test for both the folder AND the file, I still get a 403! Any tips?

    Thread Starter Zach Atkinson

    (@z_atk)

    Hi Kyle,

    Thanks for your time on this – code as follows:

    function lc_custom_image_setup () {
        if(defined('PICTUREFILL_WP_VERSION')){
            picturefill_wp_add_image_size('extra-small', 480, 9999, false, 'small');
            picturefill_wp_add_image_size('small', 768, 9999, false, 'medium');
    
            picturefill_wp_set_responsive_image_sizes(array('thumbnail', 'extra-small', 'small', 'medium', 'large'));
            apply_picturefill_wp('widget_text');
            apply_picturefill_wp_to_post_thumbnail();
    
        }
        else{
            add_image_size('extra-small', 480, 9999, false);
            add_image_size('small', 768, 9999, false);
    
        }
    }
    add_action( 'after_setup_theme', 'lc_custom_image_setup' );
    Thread Starter Zach Atkinson

    (@z_atk)

    Kyle,

    Thanks for the detailed response – the headaches do not come from anything on your end but rather me still working on wrapping my head around how things work. Please understand how grateful I am for your time and efforts on this plugin (both branches!) and taking your time to respond to the user base. I hope my post didn’t come off to you as rude.

    I will look this over and respond to both threads shortly. I have actually been using PFWP 2.0 on a client build I’m launching to replace their aging site, as such I’ve got all new things to figure out – but with your help I am confident it will be nothing I can’t handle.

    Great plugin

    -Zach

    Thread Starter Zach Atkinson

    (@z_atk)

    Resolved.

    Thread Starter Zach Atkinson

    (@z_atk)

    Marking as resolved

    All fixed now!

    Thread Starter Zach Atkinson

    (@z_atk)

    Hi Kyle,

    Reporting back – I re-enabled the function and looked for where I had called

    add_theme_support( ‘post-thumbnails’ );

    and noticed I hadn’t included set_post_thumbnail_size( x, y); anywhere! This must have been the root of the plugin hanging, it kept trying to regenerate the images each page load because it was being passed size values of 0!

    If I could suggest something else for the documentation, it would be including a note discussing this briefly. Maybe with this snippet:

    add_theme_support( ‘post-thumbnails’ );
    set_post_thumbnail_size( 1920, 1080 );

    obviously changing the sizes to whatever the user wants. Once I did this and enabled post-thumbnail code everything was flying like a rocket ship. Consider me a happy camper – I hope 2.0 is this easy to set up.

    Thread Starter Zach Atkinson

    (@z_atk)

    Hi Kyle I’m still getting a hang with this function enabled but I think I know why – I need to create a picturefill-wp-add-image-size(‘post-thumbnail’ …) correct? Right now I don’t have a post thumbnail image class (As I figured no need to add an extra class which will result in more image generation then I need).

    I am about to attempt adding a new image size “post-thumbnail” to see how the plugin reacts. I assume this will solve my issue, but will this not also generate images that size for every image in my site?

    Can I leave this size out of picturefill_wp_set_responsive_image_sizes and be confident thee new sizes will only be applied to featured images?

    Simple questions I know, but any help would be appreciated. I hope I have been clear!

    Thanks again,

    -Zach

    Hi Kyle,

    Sorry to bump a thread, and for being such a huge pain in your ass but I’m STILL having page load problems. I’ve tried to disable several plugins to see if I’m getting a conflict and met with the same problems.

    I realized I wasn’t setting my height (using 0) so I tried the value 9999 as suggested here, and my pages still seem to be re-generating the thumbs every time! (It’s the only solution that makes sense to me, disabling PicturefillWP leads to fast page loads.

    Could you take a peek at

    https://zachatkinson.com/web-services/

    And see if it doesn’t appear to hang for you too? So confused as to what could be going wrong.

    Thread Starter Zach Atkinson

    (@z_atk)

    Thanks for the quick response! Installing 1.3.4 now and excited to see how it runs. Glad you enjoy the feedback, it’s a truly powerful plugin that more people should really be learning. I am currently writing a blog post on the best way to optimize wordpress and will be featuring this plugin alongside some basic instructions for set up with bootstrap 3.

    Some of my issues also may have come from using the upBootWP bootstrap 3 framework but a quick look over didn’t lead to anything sticking out as a problem. I’m setting up now and will let you know how it goes shortly.

    Thanks again,

    -Zach

    Thread Starter Zach Atkinson

    (@z_atk)

    Reporting back. Upon inspecting the code further I pulled up the plugins functions. This is what I saw.

    function picturefill_wp_add_image_size($name, $width = 0, $height = 0, $crop = false, $insert_before = 'thumbnail'){
      if('@2x' === substr($name, -3)){
        return false;
      }
      add_image_size($name, $width, $height, $crop);
      add_image_size($name . '@2x', $width * 2, $height * 2, $crop);
    
      $picturefill_wp_helpers = new Picturefill_WP_Function_Helpers();
      $picturefill_wp_helpers->add_image_to_responsive_queue($image_size, $insert_before);
    }

    First off – this confirms that we don’t need to use the built in add_image_size function as picturefill_wp_add_image_size will pass that info on nicely for us. A concern here would be if a user had defined custom sizes with this code and then disabled the plugin for whatever reason then add_image_size would not be run – but perhaps that will be considered for the next revision.

    With that in mind – the documentation needs edited here:

    $image_size_array = array('custom_small_size', 'thumbnail', 'extra-large');
    /* All image sizes included in the $image_size_array
       must allready exist, either by default (thumbnail,
       medium, and large) or by the add_image_size function.
       Image sizes should be listed from smallest to largest
       and should not include '@2x' sizes, these will be
       added automatically. */
    picturefill_wp_set_responsive_image_sizes($image_size_array);

    Particularly the part that says “… or by the add_image_size function”. To clear up any confusion this should read “… or by the picturefill_wp_add_image_size function”.

    Let’s move on. The line in particular in question is lines 43-44 in functions-picturefill-wp.php

    $picturefill_wp_helpers = new Picturefill_WP_Function_Helpers();
    $picturefill_wp_helpers->add_image_to_responsive_queue($image_size, $insert_before);

    As we can see “$image_size” is being asked for by this function, but not provided anywhere. I assumed this meant I could interchange it for $name, since that seemed to be the authors intent with the variable, but was once again met with page hangs and endless loading.

    Is this a bug or is $image_size intentional? I’m trying to figure out more but if the author is around your input would be excellent! ??

    -Zach

Viewing 13 replies - 1 through 13 (of 13 total)