Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Changing image width in post - Autofocus+ WordPress

  • SOLVED

I customized the width of Autofocus+ layout to match my website - but can't figure out how to get the actual post images to resize.

desired size: 989x x 658h (post images only)

site: http://frolicphoto.com/dailyfrolic/

--

The theme's author has given me some clues, but not enough for me to get it done. Clues given:

- it's not just css, but also "in various PHP files"
- Regenerate Thumbnails Plugin will probably be needed
- just change all instances of 800px to 989px

I've already tried changing the default 800px to my desired 989 in functions.php -- didn't work. Didn't see 800px in any other PHP files, but no guarantees on that.
Installed + ran the plugin. Also failed to save the world.

Good luck.

And thanks :)

Answers (3)

2010-08-22

Michelle Dancer answers:

Ok if you're using the thumbnail feature (adding the images to your post where it says "add featured image" in the edit post sidebar), which you should be, this is what you'll need to do.

<strong>Note: </strong>If you've already made significant changes to the files the line numbers won't be right but you should be able to figure it out from this.

Take a look at <em>functions.php</em> and change line 234 (or whichever line starts "add_image_size( 'single-post-thumbnail'," to the following:

add_image_size( 'single-post-thumbnail', 989, 658, true ); // Single Posts thumbnail size

The true on the end there is important if you want the images to be cropped to your exact measurements, if that's left off or set to false it'll keep aspect ratio of the image so one of the measurements will be off.

Once that's changed run the regenerate thumbnails plugin and it'll resize every image you've uploaded so far.

Now depending on the CSS changes you've already made this could have your image showing up lopsided on the page.

Looks like you've already changed the width on #main div so all I think is left is to change line 202 in <em>style.css</em> (starts "#content .photo-credit ") to:

#content .photo-credit {position:absolute;padding:16px;display:block;width:957px;height:100%;z-index:2;text-align:left;}

If anything is still out of line I'll take another look but that should be pretty much it, I think.


amanda bradshaw comments:

Yay Michele!!

You win. So happy - I finally have 989 x 658 dogs.

I thought fixing the single post image would carry over to the main page as well, but it hasn't. It's just the image in the top cell that's still too small. Can we make that part of my fix too?:)

2010-08-22

Monster Coder answers:

you can use [[LINK href="http://timthumb.googlecode.com/svn/trunk/timthumb.php"]]timthumb[[/LINK]] script for resizing your image! put the timthumb.php in your theme directory and change the script files (index.php, single.php etc.) as follow!

lets assume, you have show image this way:

<img src="IMG_URL" alt="">
now replace it with the following:

<img src="<?php echo get_bloginfo('style_directory').'/timthumb.php?src=IMG_URL&h=658&w=989&zc=1';?>" alt="">

however, if you want to automatically resize any images that are inside the post content, then this won't work. this will work if you want to include any custom image or any images mentioned in custom field!

for such case, you may kindly check this URL
http://www.techtalkz.com/blog/wordpress/auto-resize-large-images-in-wordpress.html


amanda bradshaw comments:

I don't think this will work without screwing up the layout of images on the main page.

If it helps, I don't need to resize my images --- they are uploaded already sized. But the way the theme is currently written, my correctly-sized images are being downsized on the post page :(


Monster Coder comments:

<blockquote>I don't think this will work without screwing up the layout of images on the main page. </blockquote>
i have written two issue! one is timthumb and another is blog link to external site! which you did you mean?

now i am confused with your problem! do you want to resize your images? or your images are already downsized but you want them to be actual size?

please explain, i will try to help if I can!

Thanks


amanda bradshaw comments:

<blockquote>now i am confused with your problem! do you want to resize your images? or your images are already downsized but you want them to be actual size?
</blockquote>

Hi Monster Coder --

Thanks for trying to help - but i don't think timthumb or the info you linked to will solve my problem.

The images need to work in the main page layout *and* be actual size in the posts. Something in the theme is resizing the post images from actual size to 800px.

Please go to my site and click on an image. You'll see what the problem is (image in the post is 800px but should be 989px).

http://frolicphoto.com/dailyfrolic/

thnx


Monster Coder comments:

hello,
i got you now! sorry for confusing! ok, checking your site I found few 800px images:

http://frolicphoto.com/dailyfrolic/wp-content/uploads/2010/08/DF_08202010_missy-800x300.jpg
http://frolicphoto.com/dailyfrolic/wp-content/uploads/2010/08/DF_08192010_reilly-800x300.jpg
http://frolicphoto.com/dailyfrolic/wp-content/uploads/2010/08/DF_08162010_selma-800x300.jpg

opening the images on the separate window, I still see the images are 800px in width! so it is sure it is not downsized using width attribute or css!

so to comment further, I will need to check the source codes! if possible and if you want me to help further, please provide me access to your theme files in PM!

Thanks


amanda bradshaw comments:

Right.

And the uploaded size of the image was 989x658.

You can download the theme files here (autofocus+, it's free):

http://fthrwght.com/autofocus/


thanks!


Monster Coder comments:

i have downloaded the theme! please tell me how have you attached the image? so that i can reproduce it here!

2010-08-22

Baki Goxhaj answers:

At line 250 of autofocus+ <strong><em>functions.php</em></strong> file you will find the code below. There are two instances you need to change the size from 800 to your desired size.

// Custom image size settings initiated at activation
if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {
if( FALSE === get_option('af_size_w') ) {
add_option('afthumb_size_w', '188');
add_option('afthumb_size_h', '188');
add_option('afthumb_crop', '1');

add_option('aflarge_size_w', '800');
add_option('aflarge_size_h', '300');
add_option('aflarge_crop', '1');

add_option('afsingle_size_w', '800');
add_option('afsingle_size_h', '600');
add_option('afsingle_crop', '0');
} else {
update_option('afthumb_size_w', '188');
update_option('afthumb_size_h', '188');
update_option('afthumb_crop', '1');

update_option('aflarge_size_w', '800');
update_option('aflarge_size_h', '300');
update_option('aflarge_crop', '1');

update_option('afsingle_size_w', '800');
update_option('afsingle_size_h', '600');
update_option('afsingle_crop', '0');
}


If you are unable to fix that, I can do that for you.


Baki Goxhaj comments:

After you change the sizes accordingly, don't forget to use this plugin to regenerate image sizes: http://wordpress.org/extend/plugins/regenerate-thumbnails/


amanda bradshaw comments:

Baki -

I already tried that and it didn't work.

Thanks


Baki Goxhaj comments:

I'm am sure that is the place you fix it. Do you want me to have a look at it? If yes, info(@)wplancer(.)com