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'm developing a portfolio theme on WordPress 3.2.1, so i created a new post_type called 'portfolio'. My aim is to show, on the front-end, a grid composed by the jobs i realized during last years.

This gris will be filled by portfolio post_type thumbnail (featured image), when any user click on them, system shows (through fancybox) a popup with the large image in it.

So, the HTML code I expect is:

<a title="the title" href="http://path/to/wp-content/uploads/YYYY/MM/screenshot-648x1024.png" rel="something">
<img class="attachment-portfolio-thumb wp-post-image" width="214" height="187" title="screenshot" alt="screenshot" src="http://path/to/wp-content/uploads/YYYY/MM/screenshot-e1314198521926.png">
</a>

The idea is to: upload image from portfolio section (using the button add image), then save and close this section. Then, I move to media library, I open the image to crop it. Next step is to save all media, back to the portfolio section, open the post again and set the cropped image as the featured image.

What happens is that "crop" does not work. I've to crop the image twice to have a result, but it does not affect the image all the times.

Do you guys have any experience on that? Apart from the php code i use to show the thumbnail, i can't stand by wordpress and crop don't do what i need (please note that I want to crop the image, I do not need the programmatically crop that wordpress offers).

thx

share|improve this question
add comment

1 Answer

You don't need to do manual cropping; just create a custom image size, and WordPress will perform the cropping on image upload.

e.g. in functions.php:

add_image_size( 'portfolio-thumbnail', 214, 187, true );

Then in your portfolio template, inside the Loop:

the_post_thumbnail( 'portfolio-thumbnail' );

(I assume you know how to handle the rest of the output, such as creating the grid layout, and linking each thumbnail image, etc.)

Note: you'll have to regenerate thumbnails for any already-uploaded images.

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.