WordPress Fancybox Resize Large Image

I have a wordpress users that aren’t very good at resizing images so when they upload an image to wordpress it’s still big > 3000px.

They can import into a post and a thumbnail is generated. When you click on the thumbnail the image appears in a light box (using fancybox) but because the image is so big it takes ages to load.

Is it possible to open a smaller version of the image (say 800px wide) in the lightbox? Automatically, without the user having to resize the image before uploading?

Is there a plugin for this?


Solutions Collecting From Web of "WordPress Fancybox Resize Large Image"

What you will need to do is edit your theme’s functions.php file to add a new image size. Scroll to the bottom and inside the php tags enter:

add_image_size( 'fancybox-full', 800, 9999 );

This will create an uncropped image 800px wide, whenever an image is uploaded.

You will then need to edit the anchor for your images to link to this new image size. Try using wp_get_attachment_image_src() – use fancybox-full as the image size argument, not sure how yours currently gets the attachment ID, so if you need further assitance, let me know.

You will find this doesn’t currently work with the images you have already uploaded. Try using the Regenerate Thumbnails plugin.

Hope this helps.