Boonstra / Slideshow

17 stars 18 forks source link

Slideshow shows full-size images rather than thumbnails #14

Open nyanpasu64 opened 8 years ago

nyanpasu64 commented 8 years ago

The slideshow <img src=""> includes the full-size attachments, even for small slideshows. This easily results in tens of megabytes downloaded, which is wasteful on capped connections and disastrous on slow ones.

After wading through the source code, I've narrowed it down to this line:

https://github.com/Boonstra/Slideshow/blob/master/views/SlideshowPluginSlideshowSlide/frontend_attachment.php#L93

(in retrospect, it would've been faster to search Github for "wp_get_attachment_image_src", rather than tracing my way from https://github.com/Boonstra/Slideshow/blob/783328da2b28d90cb8104600861e29bbb0a7f746/classes/SlideshowPluginSlideshowSettingsHandler.php#L248 through about eight function calls.)

You should use the second argument $size to fix this. (https://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src)

To automate this process, you could use https://codex.wordpress.org/Function_Reference/wp_get_attachment_image instead. (I'm not sure if this is the best idea.)