Remember me? forgot password | register

SilverStripe Forum

1172 Posts in 334 Topics by 320 members

Jump to:

Website Authors

If this is your first visit, you will need to register before you can post. However, you can browse all messages below.

Community » SilverStripe Forum » Website Authors » Image resizing using GD
Page: 1 go to end Reply
Author Topic: Image resizing using GD 738 views
  • natalie
    avatar
    Community Member
    71 posts

    Image resizing using GD Link to this post

    I followed the tutpirial on this page: http://doc.silverstripe.com/doku.php?id=imageupload&s=image

    Using silverstripe 2.2

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

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

    Here is the code on ArtistPage.ss:

    <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?

  • Blackdog
    Blackdog's avatar
    Community Member
    136 posts

    Re: Image resizing using GD Link to this post

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

  • adiwidjaja
    avatar
    Community Member
    8 posts

    Re: Image resizing using GD Link to this post

    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 http://doc.silverstripe.com/doku.php?id=imageupload&s=image, at the end)?

    Cheers,

    Andy

    Last edited: 25 April 2008 at 2:31am

    738 views
go to top Reply

Currently Online:

Craig, LeeUmm, simon_w

Welcome to our latest member: sarahlynn