Title: Using wordpress generated image sizes in background (srcset)
Last modified: July 24, 2022

---

# Using wordpress generated image sizes in background (srcset)

 *  [leanca](https://wordpress.org/support/users/leanca/)
 * (@leanca)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/using-wordpress-generated-image-sizes-in-background-srcset/)
 * To use WP’s automatically generated image sizes as background images in SS3 you
   have to edit the file Nextend/SmartSlider3/Slider/Feature/SlideBackground.php
   
   and replace this `$imageAttributes = array( ‘src’ => ResourceTranslator::toUrl(
   $src), ‘alt’ => $alt, ‘title’ => $title, ‘loading’ => ‘lazy’, ‘style’ => ” );`
 * with this code
    `$imageSrc = ‘https:’.ResourceTranslator::toUrl($src); $imageId
   = attachment_url_to_postid($imageSrc); $imageSrcset = wp_get_attachment_image_srcset(
   $imageId ); $imageSizes = wp_get_attachment_image_sizes( $imageId );
 *  $imageAttributes = array(
    ‘src’ => ResourceTranslator::toUrl($src), ‘srcset’
   => $imageSrcset, “sizes” => $imageSizes, ‘alt’ => $alt, ‘title’ => $title, ‘loading’
   => ‘lazy’, ‘style’ => ” );`

Viewing 1 replies (of 1 total)

 *  Thread Starter [leanca](https://wordpress.org/support/users/leanca/)
 * (@leanca)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/using-wordpress-generated-image-sizes-in-background-srcset/#post-15854368)
 * And don’t forget to clear the slider cache

Viewing 1 replies (of 1 total)

The topic ‘Using wordpress generated image sizes in background (srcset)’ is closed
to new replies.

 * ![](https://ps.w.org/smart-slider-3/assets/icon.svg?rev=2307688)
 * [Smart Slider 3](https://wordpress.org/plugins/smart-slider-3/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/smart-slider-3/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/smart-slider-3/)
 * [Active Topics](https://wordpress.org/support/plugin/smart-slider-3/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/smart-slider-3/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/smart-slider-3/reviews/)

## Tags

 * [srcset](https://wordpress.org/support/topic-tag/srcset/)

 * 1 reply
 * 1 participant
 * Last reply from: [leanca](https://wordpress.org/support/users/leanca/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/using-wordpress-generated-image-sizes-in-background-srcset/#post-15854368)
 * Status: not a support question