21278 Posts in 5728 Topics by 2599 members
| Go to End | Next > | |
| Author | Topic: | 3352 Views |
-
Re: SetWidth works, resize doesn't?

13 November 2009 at 3:03pm
but should I view the prebuilt image function as unreliable
No, the prebuilt image function SetWidth, SetHeight, SetSize, CroppedImage all should work pretty well out of the box. You would only need to extend with a custom class if you needed more control over the padding, sizing or other finer details.
http://doc.silverstripe.org/doku.php?id=image is quite a detailed page. ResizedImage(150,20) is another method you can use in the template (I Believe SetSize() is new so 2.3 may not have it)
-
Re: SetWidth works, resize doesn't?

13 November 2009 at 8:08pm
Willr can you explain what happened to the ImageEditor which came with the earliest Ver of SS.
The other way of resizing in templates is by controlling the GD function
<% control MyImage %>
<% control SetSize (200,200) %>
<img src="$URL" alt="My cropped image" />
<% end_control %>
<% end_control %>The other thing to note when using GD resize functions is some a designed to be used in PHP and some in templates.
PHP
$image->resize(width,height);
Template
$Image.SetSize(80,80) // returns a 80x80px padded image
Timtim if you have read Willr's reply, the examples he gave were
....the prebuilt image function SetWidth, SetHeight, *SetSize*, CroppedImage ...
Note he mentioned SetSize and not resize. you can only use resize in PHP.http://doc.silverstripe.org/doku.php?id=image *some of the resize functions are meant to be used with the ver 2.4 and they dont work on prior versions*
Willr please bring back ImageEditor in the CMS
tx
-
Re: SetWidth works, resize doesn't?

13 November 2009 at 9:22pm
can you explain what happened to the ImageEditor which came with the earliest Ver of SS.
The original image editor was built by a student for the GSOC program in 2007 and was part of the 2.2 release. But due to javascript upgrades in 2.3 this functionality broke. We contacted the author and as far as I know we could not get a working version setup in time for 2.3 and as time has progressed the functionality has never been fixed.
I believe the ImageEditor in its 2.2 form won't be reimplemented for 2.4 or future releases, instead it would integrate with picnik.com or another similar online image editing api (or library) from within the cms.
-
Re: SetWidth works, resize doesn't?

13 November 2009 at 9:55pm
Would this also implement the ability to create a manual crop in silverstripe? This is something that I would like to be able to offer my users. Am not sure though if using a commercial third party is a good idea.
-
Re: SetWidth works, resize doesn't?

13 November 2009 at 10:00pm
The licensing of anything we integrate has to be looked at. Using a commercial API is not really an ideal option. The reason for using a third party is because it is such a big piece of functionality and its support / development time that is better spent on other segments of the product.
-
Re: SetWidth works, resize doesn't?

13 November 2009 at 10:04pm
Yurigoul im with you on manual crop in silverstripe CMS.
The CMS backend is for the Users not the developers. User must be able to manually crop and resize images in the CMS.
At time users will upload a 10mb pic into the cms. It will be great to have a form of Editing images in the cms.tx
-
Re: SetWidth works, resize doesn't?

14 November 2009 at 5:10am
I'm using the newest version I downloaded last week (2.3.3) and a fresh install of the current version of MAMP.
when I tried $HeadShot.ResizedImage(150,20) I get
<em>
Website Error
There has been an errorThe website server has not been able to respond to your request.
</em>and I get nothing in my PHP logs.
but $HeadShot.SetHeight(150) works fine. I'm a little concerned about this. it's not a huge problem, but I'm in the initial stage of building my first silverstripe page and I don't want to have to second guess things...
-
Re: SetWidth works, resize doesn't?

14 November 2009 at 5:29am
I do not see that as a function that can be used in your templates. You can use the commands given at http://doc.silverstripe.org/doku.php?id=image in the section about resizing in templates.
You could however do this:
<% control MainImage %>
<% control ResizedImage(260, 120) %>
<img src="$URL" title="$Top.Title" alt="$Top.Title" />
<% end_control %>
<% end_control %>or this:
<% control MainImage %>
<% control CroppedImage(260, 120) %>
<img src="$URL" title="$Top.Title" alt="$Top.Title" />
<% end_control %>
<% end_control %>
| 3352 Views | ||
| Go to Top | Next > |



