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.

When uploading images via the media manager there are a couple of set sizes available such as thumb, medium and large.

I do know how to add additional sizes, but I have yet to get it to insert an image with width='x%'.

the concept is that i am building an adaptive theme and I never want the inserted image to be larger than the container even upon browser resize,

By manually editing the inserted image code to include widths with a %, then it works just fine. However trying to get my users to remember this is downright impossible.

What I would like would be a button to insert an image into a post with a set % (percentage) instead of a set pixel width.

possible?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I guess what you're looking for is the $content_width global that would basically limit the width of your images, used in functions.php. Some more info here: http://mainstreetopen.com/wordpress-26-and-full-width-images/

share|improve this answer
    
Not really right. I am more looking to have the image inserted and then have the image width="70%" added to the image wrapper code. This will give me a consistent look across most browser sizes including mobile. Doing it the way you point to still causes problems. Say the user inserts an image only 400px wide, which looks rather small on a large monitor, but is very large on an iphone, Using a % on the width attribute solves this –  shawn Apr 29 '11 at 7:43
    
example: live.wptumble.com/index11.html image thumbs are animated gifs so I can't allow them to be resized when inserted into the post. I use a % on the width to keep the page looking decent on both large/small devices.... of course is someone has built a wp plugin to auto resize animated gifs,,, wow that would be cool –  shawn Apr 29 '11 at 7:45
    
How about setting the % size through CSS? The image size is appended to the image as a class. –  kovshenin Apr 29 '11 at 11:35

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.