Need alternative to slicing images

Discussion in 'PHP' started by patter, Feb 11, 2009.

  1. #1
    I'm working on a site that sells images of paintings. The client has images of frames he would like to place around those images. The problem is that the images of the paintings are in a large number of different sizes so I needed to slice the frame images and place them around the paintings using code so that they appear as one image. This works but the problem is that the frame images have shading that makes slicing them difficult. Once the image is put back together, the shading is off since I am building it from the slices.

    So I am looking for an alternative way of doing this. I saw mention on the web that this can be done with css and/or flash but I could not find any examples of it. Can anyone please explain how another method would work or even make suggestions for getting better results using image slicing?
     
    patter, Feb 11, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    If the pictures are the same size every time, or one of a number of pre-set sizes, you can create the frame image with the correct inner size for the pictures you are using. The you just need to layer the image on top of an element with the frame as the background. As long as you have the correct size background frame for the image, it should always mach up.

    There may be ways to dynamically resize the frame image, but this could get really complicated to do on the fly. You could look into imagemagick or use gd libraries to resize on the fly.

    Other than these, I don't think there is a way other than slicing each frame into 8 pieces. 1 for each side, and 1 for each corner.
     
    jestep, Feb 11, 2009 IP
  3. imphpguru

    imphpguru Active Member

    Messages:
    439
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #3
    Hi,
    Consider using phpthumb for your use. It is super sexy, and will adjust the image size to match the frames and stuff. You can read the documentation to know more!! It is really a great script for you to work with. All the best!

    imphp
     
    imphpguru, Feb 11, 2009 IP
  4. patter

    patter Member

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    Thanks for the suggestions. I did try phpthumb and it works great. The $500 fee for such a script is quite high for this type of script but if my client wants it bad enough, he will pay it. It does solve the problem and that is what I needed, so thanks for mentioning it. :)
     
    patter, Feb 15, 2009 IP