SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Addict whofarted's Avatar
    Join Date
    Aug 2001
    Location
    lost, If you find me please return me to St.Louis
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why does this work locally but not on webserver?

    according to my webhost imagmagik is installed. This works fine locally on my machine but when uploaded to my webhost it does not resize the image.

    This function is in a class:

    PHP Code:
    Function makethumb($rat)
     {  
      
    $dimen GetImageSize($this->fdir $this->fName);
      
    $width $dimen[0];
      
    $height $dimen[1];
      
      if(
    $width $rat || $height $rat)
      {
       if (
    $width $height
       { 
        
    $imageheight ceil(($rat $height) / $width); 
        
    $imagewidth $rat
       } 
         
       if (
    $height $width)
       { 
        
    $imagewidth ceil(($rat $width) / $height); 
        
    $imageheight $rat
       } 
      
       if (
    $height == $width)
       { 
        
    $imagewidth $rat
        
    $imageheight $rat
       } 
      
       
    exec('mogrify -resize ' $imagewidth 'x' $imageheight '! ' $this->fdir $this->fName ' + profile "*"');
      }

    You smell something?

  2. #2
    SitePoint Addict whofarted's Avatar
    Join Date
    Aug 2001
    Location
    lost, If you find me please return me to St.Louis
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, I looked at some notes from my webhost and I see this:

    Path to image magick /opt/ImageMagic/bin/convert

    erm.... does this mean something to me?
    You smell something?

  3. #3
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes this does mean something to you, you have to add the path in front of your commands, like this for example

    PHP Code:
    $execPath '/opt/ImageMagic/bin';
    exec("$execPath/mogrify..... 
    Hope this helps

  4. #4
    SitePoint Addict whofarted's Avatar
    Join Date
    Aug 2001
    Location
    lost, If you find me please return me to St.Louis
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope.

    Is there a way to test & make sure it's even running/installed right?
    You smell something?

  5. #5
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, i don't know. If i was you i would contact your webhost, and tell him about your problems. Maybe they can tell you what's going on.

    I'm sorry i can't be of any more help

  6. #6
    SitePoint Addict whofarted's Avatar
    Join Date
    Aug 2001
    Location
    lost, If you find me please return me to St.Louis
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I'll contact them, thanks for trying anyway
    You smell something?

  7. #7
    SitePoint Addict whofarted's Avatar
    Join Date
    Aug 2001
    Location
    lost, If you find me please return me to St.Louis
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK this is weird. I've got it working.... sort of.

    It makes the thumb fine for .jpg files but it's not touching the .gif files.

    Any idea what up with that? [img]images/smilies/confused.gif[/img]

    Here's the currnet state of the code:
    PHP Code:
    Function makethumb($rat)

    chmod ($this->fdir '/' $this->getfilename(), 0777);

    $dimen GetImageSize($this->fdir '/' $this->fName);
    $width $dimen[0];
    $height $dimen[1];

    if(
    $width $rat || $height $rat)
    {
    if (
    $width $height

    $imageheight ceil(($rat $height) / $width); 
    $imagewidth $rat


    if (
    $height $width)

    $imagewidth ceil(($rat $width) / $height); 
    $imageheight $rat


    if (
    $height == $width)

    $imagewidth $rat
    $imageheight $rat


    $path '/opt/ImageMagic/bin/';
    exec($path 'mogrify -resize ' $imagewidth 'x' $imageheight '! ' $this->fdir '/' $this->getfilename() . ' + profile "*"');
    }

    P.S. An earlier problem was the fact I was not chmod'ing the file, the other was not using the path "/opt/ImageMagic/bin/" so thanks for that [img]images/smilies/wink.gif[/img]
    You smell something?

  8. #8
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, i think this might be the reason
    (Taken directly from imagemagick.org

    Note that since Unisys claims a patent on the LZW algorithm (expiring in the US as of June 2003) used by GIF, ImageMagick binary distributions do not include support for the LZW algorithm so GIF files are written uncompressed. Users are recommended to use the PNG or JPEG formats instead, and should consult the Unisys LZW web page before enabling LZW support.
    So, my guess is that the LZW support is not enabled... Again, i have to tell you contact your webhost

    Ps: Glad you got it working

  9. #9
    SitePoint Addict whofarted's Avatar
    Join Date
    Aug 2001
    Location
    lost, If you find me please return me to St.Louis
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, here's something weird. When it tries to thumbnail a gif instead of doing the same as jpg (just resizing the file) it makes the thumbnail but it makes a new file with a .mgk extention. [img]images/smilies/confused.gif[/img]

    IE:
    file.jpg 26KB becomes file.jpg 12KB All is well here but
    file.gif 26KB stays file.gif 26KB and a new file called file.mgk 12KB is created.

    Any idea why? I'm thinking I can make the script rename the new file & delete the old if it's a gif but I'm really interested in why this is happening. [img]images/smilies/xeye.gif[/img]

    The file named file.mgk is fine if I download it & change the extention to .gif it's perfectly fine & viewable.
    You smell something?

  10. #10
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    Now that's weird, i have no idea why this happens, what does your webhost say about this?

  11. #11
    SitePoint Addict whofarted's Avatar
    Join Date
    Aug 2001
    Location
    lost, If you find me please return me to St.Louis
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by datune
    [img]images/smilies/confused.gif[/img]

    Now that's weird, i have no idea why this happens, what does your webhost say about this?
    well, Here's what they say:
    Hi , image magick is installed correctly and supports gifs , we have lots of sites using 4images that uses image magick to reproduce thumbnails if gifs ,jpegs and so on and there is no problem with them . So i can only see its your script that is not doing what it should be
    I have it working now though I just had to add this after the exec() command
    PHP Code:
    $file_ext explode('.'$this->getfilename());

    if(
    $file_ext[1] == 'gif')
    {
    unlink($this->fdir '/' $this->getfilename());
    $t str_replace('gif''mgk'$this->fdir '/' $this->getfilename());
    rename($t$this->fdir '/' $this->getfilename());

    that deletes the old (bigger fiile) then renames the thumb from .mgk to the correct .gif

    But I still don't understand why that is happening? [img]images/smilies/confused.gif[/img]
    You smell something?

  12. #12
    SitePoint Guru
    Join Date
    Feb 2002
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well. i don't understand it neither..very odd indeed.
    But hey, it's working


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •