Title: cacheImageFields issue
Last modified: April 6, 2017

---

# cacheImageFields issue

 *  Resolved [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/)
 * Hi Chester, hope you’re keeping well! I’m trying to use cacheImageFields but 
   it’s only giving me the small and large thumbnails from airtable. I’m using this
   for my query:
    $sizes = array(“medium”,”homepage-thumb”); $query->cacheImageFields(“
   Featured Image”,$sizes);
 * Am I doing something wrong?
    -  This topic was modified 9 years, 1 month ago by [mcloone](https://wordpress.org/support/users/mcloone/).

Viewing 15 replies - 1 through 15 (of 25 total)

1 [2](https://wordpress.org/support/topic/cacheimagefields-issue/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/cacheimagefields-issue/page/2/?output_format=md)

 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9002145)
 * That looks right. Here’s a few things to check:
    1. ensure wp-content/airpress-image-cache is writable
    2. ensure your query isn’t cached (use ?fresh=true while testing)
    3. check your PHP/server error log and airpress.log for clues
    4. add additional debug statements with `airpress_debug(0,"this is a string",$this_will_be_printrd);`
 * If none of that helps maybe we can do a screenshare and track it down.
    -  This reply was modified 9 years, 1 month ago by [Chester McLaughlin](https://wordpress.org/support/users/chetmac/).
      Reason: formatting
 *  Thread Starter [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9002209)
 * Ah I needed to actually create the airpress-image-cache folder for it to work.
   Next thing – it doesn’t seem to recognise my custom image sizes that have been
   added in my functions.php. Do I need to add them manually?
 * This is the error I’m getting:
    The provided size of ‘homepage-thumb’ has no 
   width or height params. Skipping.
 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9002383)
 * Thanks for the feedback. I’m releasing v1.1.22 right now which resolves this 
   issue.
 * Note: I’m still attempting to find a good fix for the fact that Airtable accepts
   image uploads from mobile devices without “applying” the rotation information
   to the original file. This means that when Airpress pulls the original file in
   order to create smaller sizes Airpress will need to read the Orientation from
   the EXIF and apply that. However, I’m working on a site on Pressable right now
   and they dissable EXIF functions and use GD (as opposed to ImageMagick) and I’m
   having a hard time figuring out a way to read the Rotation in this setup. If 
   I can’t get it I’ll simply detect ImageMagick or read_exif_data and ignore the
   rest of the environments.
 *  Thread Starter [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9002669)
 * Cool thanks for fixing that issue! I had a similar problem with image rotation
   and ended up using an ios image fix plugin for images I had imported (not using
   cacheImageFields). I had meant to take a look at the plugin to see how they were
   doing it, so it is possible.
 * So the next thing I’m trying to do with cacheImageFields is the following:
 * a) I’m trying to get an image on an individual virtual post.
    b) In that virtual
   post I’m populating a related field and need to cache image fields for that post.
 * Is this possible?
 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9003605)
 * Make sure you update (yet again) to the latest version (which is currently 1.1.24)
 * [https://youtu.be/AINHw7JNSqU](https://youtu.be/AINHw7JNSqU)
 * The following code assumes an Airpress VirtualPost configuration named, “Place”.
 *     ```
       add_image_size( "not-too-small", "300", "300", false );
   
       function my_airpress_virtualpost_query($query,$request,$virtual_post_config){
   
         // Ensure we're "targeting" the right VirtualPost configuration
         if ($virtual_post_config["name"] == "Place"){
   
           // Create a new Query that will be the related query
           $district_query = new AirpressQuery("City Districts");
           $district_query->cacheImageFields("Pictures", array("not-too-small","medium","full"));
   
           // Add the above query to the Virtual Post query
           $query->addRelatedQuery("District",$district_query);
           $query->cacheImageFields("Pictures", array("not-too-small","medium"));
         }
   
         return $query;
       }
       add_filter("airpress_virtualpost_query", "my_airpress_virtualpost_query",10,3);
       ```
   
    -  This reply was modified 9 years, 1 month ago by [Chester McLaughlin](https://wordpress.org/support/users/chetmac/).
      Reason: formatting
 *  Thread Starter [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9006932)
 * Hey Chester, thanks for this although I’m having trouble with it. It doesn’t 
   seem to be caching the images, but it is adding the related query. If I print
   out the image array it has the standard airtable stuff. When I look at the logs
   I see this:
 * Projects VirtualPost ^project/(.*)/?
    200 1 2.51 Projects?filterByFormula={Slug}
   = ‘project name’ 200 21 0.47 Portfolio?filterByFormula=OR(…one of 21 ids…) Name
   exists so post_name is Project Name. Name exists so post_title is Project Name.
 * I wonder if the filter by formula is wrong?
 * This is the code I’m using (the field in Projects is called Portfolio, as is 
   the table name)
 *     ```
       function my_airpress_virtualpost_query($query,$request,$virtual_post_config){
   
         // Ensure we're "targeting" the right VirtualPost configuration
         if ($virtual_post_config["name"] == "Projects"){
   
           // Create a new Query that will be the related query
           $portfolio_query = new AirpressQuery("Portfolio");
           $portfolio_query->cacheImageFields("Featured Image", array("large","full"));
   
           // Add the above query to the Virtual Post query
           $query->addRelatedQuery("Portfolio",$portfolio_query);
           $query->cacheImageFields("Featured Image", array("large","full"));
         }
   
         return $query;
       }
       add_filter("airpress_virtualpost_query", "my_airpress_virtualpost_query",10,3);
       ```
   
    -  This reply was modified 9 years, 1 month ago by [mcloone](https://wordpress.org/support/users/mcloone/).
 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9007002)
 * Are you up for doing a Google Hangout and sharing your screen with me? That way
   we could walk through it and figure it out. I can’t find a Private Message option
   here on WordPress support forums. Do you have an Airtable account at [http://community.airtable.com](http://community.airtable.com)
   so I can PM you my contact info?
 *  Thread Starter [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9007092)
 * Yep I’m on there are Tim_McLoone
 *  Thread Starter [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9007115)
 * I just went to the Virtual Posts admin and noticed this issue:
 *     ```
        Notice: Undefined index: Orientation in /Users/TinymillTim/dev/wordpress/wp-content/plugins/airpress/lib/chetmac/AirpressQuery.php on line 672
       ```
   
 * I’m also seeing that on the virtual posts, it usually goes away if I do ?fresh
   =true but weird it’s doing it on the admin page
 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9007389)
 * As we discussed (and for those who come across this thread), Airpress was double-
   appending the file extension on the “full” cached image—this has been fixed.
 * Also, Airpress wasn’t ensuring `$exif['Orientation']` was actually set, but now
   it does.
 * And lastly, when using the airpress_virtualpost_query to add related queries 
   or cache images, it massively slowed down the process of saving the Virtual Post
   configuration, but now it “slims” the query down so that it simply serves the
   purpose of testing that config against Airtable, not actually fetching and processing
   all the data that the Virtual Post would process from an actual page load.
 *  Thread Starter [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9007463)
 * Thanks for going through this, although it seems like now there is no file extention
   at all 😰
 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9007522)
 * d’oh. 😕🌴 fixed v1.1.27
 *  Thread Starter [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9007557)
 * Thanks 😀
 *  Thread Starter [mcloone](https://wordpress.org/support/users/mcloone/)
 * (@mcloone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9008205)
 * Hitting this error on that one page with a lot of images:
    ( ! ) Fatal error:
   Call to undefined method WP_Error::get_size() in /Users/TinymillTim/dev/wordpress/
   wp-content/plugins/airpress/lib/chetmac/AirpressQuery.php on line 625
 * There’s a total of 133 images trying to be loaded.
 *  Plugin Author [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * (@chetmac)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/#post-9008232)
 * Add this after line 597 in AirpressQuery.php and then let me know what the debugger
   output is.
 *     ```
       if ( is_wp_error( $wordpress_clone ) ){
         airpress_debug($this->getConfig(),"wp_get_image_editor error: $clone_image_path",$wordpress_clone);
         continue;
       }
       ```
   

Viewing 15 replies - 1 through 15 (of 25 total)

1 [2](https://wordpress.org/support/topic/cacheimagefields-issue/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/cacheimagefields-issue/page/2/?output_format=md)

The topic ‘cacheImageFields issue’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/airpress_c9d28c.svg)
 * [Airpress](https://wordpress.org/plugins/airpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/airpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/airpress/)
 * [Active Topics](https://wordpress.org/support/plugin/airpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/airpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/airpress/reviews/)

 * 26 replies
 * 2 participants
 * Last reply from: [Chester McLaughlin](https://wordpress.org/support/users/chetmac/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/cacheimagefields-issue/page/2/#post-9020316)
 * Status: resolved