PHP GD Libraries and Image Distortion

Discussion in 'PHP' started by theduke56789, Nov 5, 2005.

  1. #1
    Images on my site are getting distorted for some reason. I was told that installing ImageMagick would solve the problem.

    Example:
    http://www.golfhomeconnect.com/results-community/36/2/Bay-Creek.htm

    But, I am unable to install anything on my managed host.

    The images that are distorted are managed through the backend cms (i.e. you upload an image).

    Is there a simpler resolution?
     
    theduke56789, Nov 5, 2005 IP
  2. durango

    durango Guest

    Messages:
    83
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Maybe you can post what code you're using to generate the images. I've found that if you are uploading images and resizing using the image libraries, I have had to make sure I output the same file type as the input for best quality. For example, if I upload a huge JPG, and want to resize it down, for the best quality output a JPG. Same for GIF, PNG, BMP, etc.

    When the file is uploaded I check the extension. If its a JPG then I call imagecreatefromjpeg, and if its a GIF I call imagecreatefromgif, etc..

    Hope this helps.
     
    durango, Nov 5, 2005 IP
  3. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The GD 1.x library only has support for 256 colors, you would need to use the GD2.x library to get the true colour images.

    To do this you would need to modify the script slightly and also install GD2 - it is likely that GD2 is already installed but you need to ask your host.

    If you have any problems in altering the script I did this last week so PM me.
     
    dave487, Nov 7, 2005 IP