Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Images Show Up Compressed


Go to End


16 Posts   111650 Views

Avatar
Willr

Forum Moderator, 5523 Posts

25 July 2008 at 11:33am

It could be that when you inserted the image in the content area the image resized to 600px to fit the TinyMCE Window?

What happens when you insert the image if you enter 642px in the width box? Does it still resize it

Also as a note to stop SS reducing quality in images you can set the global quality in your mysite/_config.php file by adding this line

// Make all images nice and fancy
GD::set_default_quality(100);

By default its about 75 I think so this will increase load times and CPU work that needs to be done therefore it will use more PHP Memory as well so if you are on a slow shared host I wouldnt recommend it! but it will give you crisper images

Avatar
Liam

Community Member, 470 Posts

25 July 2008 at 11:35am

Ok the plot thickens.

I run my own server with multiple websites. I have an older client site running 2.2.2 rc3, and uploaded said image I'm testing into that site to test out. Uploaded through that website, it works perfectly and no major quality loss. Only some cause the setting is at 90, but it works as should. Odd.

Avatar
Liam

Community Member, 470 Posts

25 July 2008 at 11:45am

Edited: 25/07/2008 11:48am

willr,

Does setting the GD quality in the config file make it slower than setting it in the gd.php file? I'm assuming no, and you just mean the memory issue is caused by having higher quality image, just want to be positive.

As for the resized image, as soon as I click the thumbnail image in tiny_mce preview, it maxes out the value at 600px. I can resize it to the proper dimensions before inserting it, and it loads fine in the content area, but this isn't very convenient for clients. Shouldn't be a problem for this site, but in general I'm curious.

*Edit* Just put it in the config, and error was thrown saying called to undefined method. Is this even a setting or did you type it wrong?

Avatar
Willr

Forum Moderator, 5523 Posts

25 July 2008 at 11:57am

I dont think Ive typed it wrong? what version of SS you using?

GD::set_default_quality() calls the function set_default_quality() in the GD class (GD.php) so if you open GD.php (its in sapphire/filesystem?) I think it was renamed from setQuality() to set_default_quality() so try setQuality()

Avatar
Liam

Community Member, 470 Posts

25 July 2008 at 12:04pm

I'm using 2.2.2, latest version not trunk. Downloaded off website.

In gd.php it has it as setQuality()

I changed the line to GD::setQuality(90); in the config, but am given this error: "Using $this when not in object context", when I try to load the page.

Avatar
Willr

Forum Moderator, 5523 Posts

25 July 2008 at 12:09pm

sorry I am getting myself confused you cant call setQuality as its not static... set_default_quality() is not on 2.2.2 its on trunk sorry for confusing you! Theres no way to globally set it in 2.2.2.

Avatar
Liam

Community Member, 470 Posts

25 July 2008 at 12:13pm

lol I was going to say...

That makes sense. No worries. Glad to see the setting is coming in the future though, as that'll help the upgrade process.

Now if I can just find out why on this one website with 2.2.2, the image is being compressed, yet on the exact same server with 2.2.2rc3 it's not. It's driving me crazy...

Oh well, thanks for the help. If anybody has any other suggestions, that would be great but I have a feeling I'm stuck.

Avatar
Anatol

126 Posts

6 August 2008 at 1:48pm

Hi,

I found it actually unnecessary that images are resampled even if I did not resize them in the WYSIWYG editor (which I usually never do). There is a 3-line-hack that forces Silverstripe to use the original image if it was not resized. See here: http://silverstripe.com/site-builders-forum/flat/9740#post12044

If you already created content with images you need to add the images again in the WYSIWYG to make these pages work.

Cheers!
Anatol

Go to Top