Image Caching for IDX Listing Photos
Image caching improves page load speed by serving optimized, resized images from the API server instead of relying on full-size remote image hotlinking.
Most listing images can be hotlinked directly from the IDX image server. However, some RETS servers prohibit hotlinking. In those cases, image caching must be enabled in the plugin settings to display listing photos properly.
How It Works
When image caching is enabled, your site fetches, resizes, and stores listing images via the API server. This reduces file size and improves loading times on listing pages.
Code Example: Displaying a Listing Image
Use the following PHP code to render a cached listing image:
<?php
$photo = rws_idxCommon::listing_photo('', $data["mls_num"], 'lg-thumb');
?>
<img style="vertical-align: middle;" src="<?php echo rws_idxCommon::rws_idx_get_image($photo); ?>" alt="<?php echo $title; ?>" />
$data["mls_num"]
– MLS number of the listing.'lg-thumb'
– Image size key (explained below).
Image Size Options
You can use the following size keys with listing_photo()
to return different image sizes:
Size Key | Dimensions | Example URL |
---|---|---|
full |
640x480 | ...&s=full |
lg-thumb |
320x240 | ...&s=lg-thumb |
thumb |
80x60 | ...&s=thumb |
tinythumb |
64x48 | ...&s=tinythumb |
w=100&h=250 |
Custom Size | ...&w=100&h=250 |
Example for large thumbnail:
http://api00.realtywebsolutions.net/images/resized/214014949.jpg&s=lg-thumb
Example for custom size:
http://api00.realtywebsolutions.net/images/resized/214014949.jpg&w=100&h=250
⚠️ RETS Compatibility Note
If your RETS feed does not allow image hotlinking, image caching must be enabled in the plugin settings to access listing images.