icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.
Old January 13th, 2007, 8:27 PM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Aug 2004
8 posts
Gave thanks: 0
Thanked 0 times
ImageMagick doesn't convert

I'm trying to convert a set of images in a folder using ImageMagick. I have the path to ImageMagick as /usr/bin/X11/convert and verified it as version 6.2.7. The code i'm running is this snippet:
PHP Code:
mkdir($g."/images");
    for(
$i=0;$i<$x;$i++)
    {
        if(
strpos($files[$i], '.') !== 0)
        {
            
//echo $g."/originals/ ".$files[$i]." ".$i."<br>";
            
$img_size=getimagesize($g.'/originals/'.$files[$i]);
            if (
$img_size[0] > $img_size[1])
            {
                
$convert'/usr/bin/X11/convert '.$g.'/originals/'.$files[$i].' -resize 450x450 '.$g.'/images/'.$files[$i];
            }
            else
            {
                
$convert'/usr/bin/X11/convert '.$g.'/originals/'.$files[$i].' -resize 450x450 '.$g.'/images/'.$files[$i];
            }
            echo 
"<br>".$convert;
            
system($convert) or die('<br>Bad Exection');
        }
    } 
THe mkdir works fine and the directory is created and the command looks ok as the page echos
Code:
/usr/bin/X11/convert /home/gr8bear/public_html/photos/files/2007-0112_Friday at Temple University/originals/IMG_0030.JPG -resize 450x450 /home/gr8bear/public_html/photos/files/2007-0112_Friday at Temple University/images/IMG_0030.JPG
I used exec() before using system() and the same errors were given. What am i missing?
gr8indianbear is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old January 13th, 2007, 9:24 PM   #2 (permalink)
Registered User
Fresh Surpasser
 
Joined in Aug 2004
8 posts
Gave thanks: 0
Thanked 0 times
Well, i think it was the file name. I enlcosed the filepath with quotes (") and used system and the images converted fine.
gr8indianbear is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old January 13th, 2007, 10:19 PM   #3 (permalink)
Surpass Fan
Excelling Contributor
 
cowboy's Avatar
 
Joined in Nov 2005
Lives in Colorado
Hosted on DEDI
937 posts
Gave thanks: 2
Thanked 95 times
Quote:
Originally Posted by gr8indianbear View Post
Well, i think it was the file name. I enlcosed the filepath with quotes (") and used system and the images converted fine.
The quotes were required because of the spaces in your path. With linux on the web, avoid path and filenames with spaces.
__________________
Where would you be if you were at the highest court in the land (US)?
cowboy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On