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.

Archive /

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

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

Image resizing using GD

Go to End

3 Posts   2383 Views

Decisive Flow

Community Member, 73 Posts

23 April 2008 at 11:52am

I followed the tutpirial on this page:

Using silverstripe 2.2

Here is my (non working) code (located on ArtistPage.php):

class ArtistPage_ResizedImage extends Image {
function generateArtistResized($gd) {
return $gd-> paddedResize(340,340);

Here is the code on

<img src="$Resized.ArtistResized.URL" alt="$Title"/>

It appears to be exaclty the same as what they told me to do, but it doesn't work!

The image I've uploaded is called PrimaryImage in ArtistPage.php if that has anything to do with it.

Any help?


Community Member, 156 Posts

24 April 2008 at 4:06pm

any reason you aren't using the inbuilt resizing image controls?


Community Member, 14 Posts

25 April 2008 at 2:31am

Edited: 25/04/2008 2:31am

Yes, does this

<% control PrimaryImage %>
  <% control ResizedImage(340,340) %>
   <img src="$URL" alt="My resized Image" width="340px" height"340px" />
  <% end_control %>
 <% end_control %>

not work (following, at the end)?