Current location: Hot Scripts Forums » Advertising Forums » Job Offers & Assistance » Quick ImageMagick problem fix

Quick ImageMagick problem fix

Reply
  #1  
Old 11-22-04, 09:49 PM
jasong jasong is offline
Wannabe Coder
 
Join Date: Feb 2004
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Quick ImageMagick problem fix

Hi there,

I am very frustrated with trying to get ImageMagick to work on my site, I've been working on this problem for a few days and have had no luck. So decided to see if I can get somebody can do it for me.
Normally I pick these things up very quick, but it seems I am ImageMagick handicapped.

ImageMagick IS installed on my account, and I have the path to ImageMagick.

I also have the ability to use the exec() function.

Your Task:

Will be to resize one image (jpeg) to another using ImageMagick and PHP.
The sizes must be able to be controlled with variables.
This will not make a additional copy and resize it, it will resize the current image.

If possible, also the ability to controll the quality of the image through a variable.

There are SEVERAL small scripts out there to do this, and yes I have tried them all and none have worked.

If you know how to use ImageMagick, this task really should be quick. Therefore, I am willing to pay no more than ten dollars via paypal to complete this (simple) job.
You will not be paid if the script does not work ( I hope that makes sense).

If you would be willing to do this, please send me a private message for more info (though I pretty much said everything here ).


Thanks,
Jason
Reply With Quote
  #2  
Old 11-24-04, 11:52 AM
wiseguy's Avatar
wiseguy wiseguy is offline
Newbie Coder
 
Join Date: Mar 2004
Location: USA
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
See how this will work...
This is the slightly modified thumbnailer code for ImageMajick from Reflection-ig.com in their gallery (which I run...)
Code:
		exec("{$ibforums->vars['gallery_im_dir']}identify -verbose {$file}", $returnarray);
		$returnarray[2] = str_replace("Geometry: ", "", $returnarray[2]);
		list($length, $height) = explode("x", $returnarray[2]);

		$this->size = "{$length} {$ibforums->lang['pixels']} x {$height} {$ibforums->lang['pixels']}";

		if($length > ( $ibforums->vars['gallery_max_tw'] - 2 ) or $height > ( $ibforums->vars['gallery_max_th'] - 2 ))
		{
			$ratio = ($length > $height) ? ($height / $length) : ($length / $height);

			exec("{$ibforums->vars['gallery_im_dir']}mogrify -resize " . ( $ibforums->vars['gallery_max_tw'] - 2 ) . "x" . ( $ibforums->vars['gallery_max_th'] - 2 ) . " {$file} ");
		}

		copy("./uploads/images/blank.jpg", "./uploads/images/blank_tmp{$id}.jpg");

		if($ratio > 0)
		{
			$width = ($length > $height) ? ( $ibforums->vars['gallery_max_tw'] - 2 ) : (( $ibforums->vars['gallery_max_th'] - 2 ) * $ratio);
			$height = ($length > $height) ? ($width * $ratio) : ( $ibforums->vars['gallery_max_th'] - 2 );

			$x = ( $ibforums->vars['gallery_max_tw'] - $width ) / 2;
			$y = ( $ibforums->vars['gallery_max_th'] - $height ) / 2;
		}else
		{
			$x = ( $ibforums->vars['gallery_max_tw'] - $length ) / 2;
			$y = ( $ibforums->vars['gallery_max_th'] - $height ) / 2;
		}

		exec("{$ibforums->vars['gallery_im_dir']}composite -geometry +{$x}+{$y} {$file} {$ibforums->vars['upload_dir']}/images/blank_tmp{$id}.jpg {$file}");

		unlink("{$ibforums->vars['upload_dir']}/images/blank_tmp{$id}.jpg");
$file is the file (including the complete path...
You must have a blank.jpg file and give it the complete path to it and a place to put a copy of it while it resizes it, the file should have no more than a 1 px border and its background will be the color of the background of any extra space on the image.
$ibforums->vars['gallery_max_th'] is the max thumbnail hieght
$ibforums->vars['gallery_max_tw'] is the max thumbnail width
$ibforums->vars['gallery_im_dir'] is the path to image majick
$ibforums->vars['upload_dir'] is the path to the upload directory...
/images past that is where it expects blank.jpg and where it expects to put its temp files
$id is the images id which it use in the temp file name and origanaly would have been used in the thumbnail name as this normally would be used to create a new file thumbnail and not just resize the other file.
/thumbs is where it expects the thumbnail to go...

PS If this doesn't work I can't help because I have no idea how to use ImageMajick the gallery was given to me with this part already written. I can write in GD graphic manipulation though.
If it just returns some small error I may can fix it as I editted the code...
If you would like to donate to reflections if this works you can do that on reflections-ig.com in the forums
__________________
How's the weather where you live?

(Avatar Text I didn't do it, it was that shredder.)
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fix my script (earn a few bucks) SpidersandWebs Job Offers & Assistance 2 10-25-04 06:10 PM
Count problem kasic ASP.NET 1 10-20-04 01:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 10:13 AM
PHP Sessions problem dannyallen PHP 1 06-26-04 11:43 AM
mysql fetch array problem darkcarnival PHP 1 03-31-04 07:49 PM


All times are GMT -5. The time now is 12:07 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)