741 posts
  • Has been a member for 5-6 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Most Wanted Bounty Winner
  • Bought between 50 and 99 items
  • Poland
  • Referred between 10 and 49 users
Orbital_Themes says

Is there any way to overwrite the default media settings (image sizes) from within my theme?

I don’t want to get thousands of support request about images having wrong sizes just because someone didn’t read theme documentation and didn’t set the image sizes correctly. :(

229 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • United States
Pressateers says
http://codex.wordpress.org/Function_Reference/add_image_size

Then when you use wp_get_attachment_src you specify the name of the size you added.

741 posts
  • Has been a member for 5-6 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Most Wanted Bounty Winner
  • Bought between 50 and 99 items
  • Poland
  • Referred between 10 and 49 users
Orbital_Themes says

I think you misunderstood me. I was asking about how to overwrite the default WP media settings. By default, when you install WordPress, the thumbnail size is set to 150×150.

Now I don’t wan’t to add separate thumbnail size, and this way create unnecessary bloat in uploads folder since my theme won’t even use the 150×150 size.

I wan’t to be able to overwrite media settings when my theme is activated. The set_post_thumbnail_size doesn’t seem to change the default 150×150 that is set in media settings.

229 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • United States
Pressateers says

I don’t believe it will physically change the value in Media Settings, but it will work for your theme provided you have this code set in functions.php:

 add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size(...);
1593 posts Building the Web.
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Bought between 50 and 99 items
  • Has been a member for 4-5 years
+2 more
ZoomIt says

do a wpdb UPDATE query on theme activation for wp->prefix.’options’ ..

               64    0    thumbnail_size_w    150    yes
               65    0    thumbnail_size_h    150
and
67    0    medium_size_w    300    yes
               68    0    medium_size_h    300
and whatever you wish

741 posts
  • Has been a member for 5-6 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Most Wanted Bounty Winner
  • Bought between 50 and 99 items
  • Poland
  • Referred between 10 and 49 users
Orbital_Themes says

Nice, that’s what I was looking for :D But… Could you possibly share the full code for it? I’m not good in manually messing with database.

1593 posts Building the Web.
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Bought between 50 and 99 items
  • Has been a member for 4-5 years
+2 more
ZoomIt says

Yeah sure -


if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ){
    global $DZSContactForm, $wpdb;

    $wpdb->query("UPDATE $wpdb->options
SET option_value='145'
WHERE option_name='thumbnail_size_w'");

    $wpdb->query("UPDATE $wpdb->options
SET option_value='145'
WHERE option_name='thumbnail_size_h'");

}

I charge 7,499.99US$ / hour – I’ll wait the payment on PayPal for an hour

741 posts
  • Has been a member for 5-6 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Most Wanted Bounty Winner
  • Bought between 50 and 99 items
  • Poland
  • Referred between 10 and 49 users
Orbital_Themes says

Thank you ZoomIt, this is a very nice function but I won’t pay for it. My girlfriend doesn’t like it too much. There is a reference to $DZSContactForm object, which, she says, is not utilized in my framework. She doesn’t like having undefined objects in my functions. Sorry for inconvenience.

Wish you all the best, Mateusz

1593 posts Building the Web.
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Bought between 50 and 99 items
  • Has been a member for 4-5 years
+2 more
ZoomIt says

Yea, you can just delete that reference

Glad to help

741 posts
  • Has been a member for 5-6 years
  • Sold between 50 000 and 100 000 dollars
  • Exclusive Author
  • Most Wanted Bounty Winner
  • Bought between 50 and 99 items
  • Poland
  • Referred between 10 and 49 users
Orbital_Themes says

I was just kidding mate, thanks for helping :)

by
by
by
by
by
by