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 created a plugin and i need to use add_image_size in it.

I know how it work in the function file and for a theme, but how can i implement this in a plugin?

I want new images uploaded by wordpress users to be smaller for mobile with

add_image_size( 'wp_small', 60, 75, true ); //mobile

I read that you need to use init or admin_init but i don't know how to implement this.

share|improve this question
    
I just found the solution and wanted to post it here but i have to wait 8 hours to post it. –  Gino Jun 7 '12 at 2:16
add comment

1 Answer 1

Just call this function in the init action. This action is fired for both frontend and backend. So it should look like this:

add_action( 'init', 'wpse4378_add_new_image_size' );
function wpse4378_add_new_image_size() {
    add_image_size( 'wp_small', 60, 75, true ); //mobile
}
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.