kylereicks / picturefill.js.wp

A WordPress plugin to use Picturefill.js for image loading.
106 stars 10 forks source link

Undeclared Variable returned in setup_responsive_image_sizes (class-picturefill-wp-function-helpers.php) #34

Closed zachatkinson closed 10 years ago

zachatkinson commented 10 years ago

Hi Kyle,

Keep up the great work - I spy a picturefill 2.0 branch! While looking over the code for the 1.3.4 built I found another variable error. The file in question is "class-picturefill-wp-function-helpers.php" and the specific line is the return code on 206.

private function setup_responsive_image_sizes($image_size_array){
      global $_wp_additional_image_sizes;
      $existing_image_sizes = get_intermediate_image_sizes();
      $new_image_queue = array();
      foreach($image_size_array as $image_name){
        if('@2x' === substr($image_name, -3) || !in_array($image_name, $existing_image_sizes)){
          return $mage_queue;

This function needs to return $new_image_queue as $image_queue is an undeclared variable. I tried to push this change into the master branch but didn't have access. I am still somewhat new to GitHub, is there a place I can push my changes for you to review for the master branch? It may help with some of the workload for you.

I also want to suggest using the great JetBrains PHPStorm IDE. It has quickly flagged the last two undeclared variables ($image_sizes in 1.3.3 and now this.) I find it an invaluable tool. Keep up the great work.

PS - Is Picturefill 2.0 far enough along to test on my deployment?

-Zach

kylereicks commented 10 years ago

Good catch on the variable name typo. Thanks very much for pointing it out.

The 2.0 branch is working pretty well, but still in a beta phase. By which I mean that I am actively adding features, any of which may break previous implementations. Feel free to try it out and play around. The more eyes on it the better, and any insight into customization and extension use-cases is always appreciated.

Thanks again