Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

Thanks

share|improve this question
add comment

migrated from stackoverflow.com May 16 '11 at 8:22

This question came from our site for professional and enthusiast programmers.

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.