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.

Is there a filter or hook that I can use for uploaded media?

I need to use it for custom CSS properties based on the media's description. It will be like:

<img src="image_url" style="width:  60%;" />

or

<img src="image_url" style="width:  80%;" />

Media description screenshot:

Edit Media screenshot

share|improve this question
    
Have you checked code of plugins that do similar things, e.h. shadow-/lightbox plugins? –  Raphael Jan 19 '12 at 19:48
1  
Are these images post images, or something else? Are you wanting to define the inline CSS manually, or automatically? –  Chip Bennett Jan 19 '12 at 21:41
    
Have you checked code of plugins that do similar things, e.h. shadow-/lightbox plugins? – Raphael yesterday — No, I'm not sure they are doing the same thing. –  mvod Jan 21 '12 at 13:33
    
Are these images post images, or something else? — Yes, these images post images. –  mvod Jan 21 '12 at 13:39
2  
What's your endgoal - your real target? You're so far only talking about what you want to achieve and so far it's off topic. Why don't you edit your post and tell us your situation and what you need. –  kaiser Oct 23 '12 at 0:10
show 2 more comments

2 Answers

After inserting the image, click it again and click the small edit window. You can then add inline CSS using the Advanced Settings already built into WordPress.

enter image description here

share|improve this answer
add comment

Why wouldn't you just use jQuery?

$(selector).css('width','60%')
share|improve this answer
    
I don't think so. Width is different for each image. For example Media Description is 80% so html must be <img src="image_url" style="width: 80%;" /> –  mvod Jan 22 '12 at 18:43
    
the way i will do such kind of issue is that i will get description width and set the image width from description width using javascript. Why cant u try that? –  balamurugan Dec 25 '13 at 6:19
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.