icon Learn how to get the most out of Surmunity - read our forum tips here! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » PHPsuexec » Alternative to exec()?

PHPsuexec Information and tips

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old August 23rd, 2007, 6:28 AM   #1 (permalink)
JMF
Registered User
Seasoned Poster
 
JMF's Avatar
 
Joined in Jun 2004
Lives in Tennessee, USA
Hosted on Pass56
32 posts
Gave thanks: 1
Thanked 1 Time in 1 Post
Alternative to exec()?

Hi! I'm running a script on my site that grabs a picture and shrinks it to a certain size like this:

PHP Code:
exec("/usr/bin/convert -resize 186x picotd.jpg picotdsm.jpg"); 
It hasn't been working lately, triggering an "exec() has been disabled" error.

I can find my way around PHP, but am kind of new to it -- is there another way I can resize the images without using exec()?

Thanks!
Jeff.
JMF is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 5th, 2007, 4:06 PM   #2 (permalink)
Surpass Fan
Comfy Contributor
 
jdcopelin's Avatar
 
Joined in Feb 2004
Lives in Norfolk, England
Hosted on Pass32
145 posts
Gave thanks: 16
Thanked 17 times
Quote:
Originally Posted by JMF View Post
Hi! I'm running a script on my site that grabs a picture and shrinks it to a certain size like this:

PHP Code:
exec("/usr/bin/convert -resize 186x picotd.jpg picotdsm.jpg"); 
It hasn't been working lately, triggering an "exec() has been disabled" error.

I can find my way around PHP, but am kind of new to it -- is there another way I can resize the images without using exec()?

Thanks!
Jeff.
Hello,

I just came across your post, sorry if the reply is too late. In case you haven't found a solution or someone else stumbles onto this thread with a similar question, you might want to look at using the (PHP) GD image library. There is a tutorial here that looks like it could be useful for someone with PHP knowledge:
http://www.phpit.net/article/image-m...-php-gd-part2/

Regards
Jonathan
__________________
Server: Pass32 and dedicated server
jdcopelin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old September 6th, 2007, 1:19 PM   #3 (permalink)
Senior Member
Super #1
 
FredFredrickson's Avatar
 
Joined in Nov 2003
Lives in New Hampshire
1,121 posts
Gave thanks: 3
Thanked 20 times
Blog Entries: 8
Code:
$size = 150; //Desired width. Height will be scaled Automatically.
$quality = 70; //Desired Quality of Resized Image out of 100.
$pathtoimage = "/path/to/image.jpg"; Path or URL to the picture
$pathtonewimage = "/path/to/newimage.jpg"; Your PATH TO resized picture

$src = ImageCreateFromJPEG($pathtoimage);

if(imagesx($src)>$size)
{
	$xsiz = $size;
}
else
{
	$xsiz = imagesx($src);
}

$ysiz = (((imagesy($src))*($xsiz))/imagesx($src));
						
$thumbnew = imagecreatetruecolor($xsiz, $ysiz);
imagecopyresampled($thumbnew,$src,0,0,0,0,$xsiz,$ysiz,imagesx($src),imagesy($src));
						
imagejpeg($thumbnew, $pathtonewimage, $quality);
__________________
The Coding Blog - Follow along as we discover and discuss everything it takes to code an entire website, start to finish! [Latest Entry: 4/4/08 - Starting a Website]
FredFredrickson 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