Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Default image quality control

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1933 Views
  • Rawbit
    Avatar
    Community Member
    52 Posts

    Default image quality control Link to this post

    I'm interested in an easier way to control the default quality of uploaded images. So far i've been manually editing this line in GD.php:

    protected static $default_quality = 75; // I change this to 100

    The problem is each time I update SS, this is overwritten. Does anyone have a more practical suggestion for this that could be saved in mysite folder or in the database?

    Also - it would be really nice to have this option not only in the admin area, but to allow a radiobox to chose between imageMagick and GD (I know this is a lot more work than it sounds). For now, I'm really only interested in a practical fix for controlling this image quality outside of GD.php

  • UncleCheese
    Avatar
    4085 Posts

    Re: Default image quality control Link to this post

    You can probably do this:

    _config.php

    GD::set_stat('default_quality',100);

  • Rawbit
    Avatar
    Community Member
    52 Posts

    Re: Default image quality control Link to this post

    UncleCheese,

    Thanks for the replies - I tried this and got (on the upload tab and on attempting to flush):

    Fatal error: Using $this when not in object context in C:\wamp\www\rob\silverstripe\sapphire\core\Object.php on line 387

    I tried something different based on your idea:
    GD::set_default_quality(100);

    [edit] I'm not sure if it's working or not now

  • UncleCheese
    Avatar
    4085 Posts

    Re: Default image quality control Link to this post

    Bah.. sorry about that.

    singleton('GD')->set_stat('default_quality',100);

  • Rawbit
    Avatar
    Community Member
    52 Posts

    Re: Default image quality control Link to this post

    Excellent - seems to be working great. Thanks!

    1933 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.