Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
gsmnaren
Posts: 7 Joined: 2011-01-02T06:46:35-07:00
Authentication code: 8675308
Post
by gsmnaren » 2011-01-02T07:11:58-07:00
hi all,
sory for creating new topic here....
i need some script so only i created new topic....
very urgent i need this to done my project...
anotherprogrammer123
Posts: 36 Joined: 2010-02-21T18:02:40-07:00
Authentication code: 8675308
Post
by anotherprogrammer123 » 2011-01-02T08:37:06-07:00
What are you trying to do exactly?
To crop, use the Crop command in Magick++:
Code: Select all
// Crop the image to specified size (width, height, xOffset, yOffset)
image.crop( Geometry(100,100, 100, 100) );
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2011-01-02T21:38:46-07:00
gsmnaren
Posts: 7 Joined: 2011-01-02T06:46:35-07:00
Authentication code: 8675308
Post
by gsmnaren » 2011-01-02T21:57:35-07:00
ya i have try this but i didn't understat...
can u plz do like that...
Bonzo
Posts: 2971 Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Post
by Bonzo » 2011-01-03T03:27:59-07:00
This should get you started:
Code: Select all
<?php
// If the form has been submitted do this
if ( isset( $_POST['Submit'] ) ){
// Temporary upload image name
$original_image = $_FILES['filename']['tmp_name'];
// Name to save the image as - in this case the same as the original
$new_image = $_FILES['filename']['name'];
$size = getimagesize ($original_image);
// crop out the images and save
$cmd = "$original_image -gravity northwest".
" ( +clone -crop 100x200+20+125 -write 1.jpg +delete ) ".
" ( +clone -crop 100x40+140+205 -write 2.jpg +delete ) ".
" ( +clone -crop 100x40+250+205 -write 3.jpg +delete ) ".
" ( +clone -crop 100x40+360+205 -write 4.jpg +delete ) ".
" -crop 100x40+470+220 5.jpg ";
exec("convert $cmd ");
$cmd = " -size {$size[0]}x{$size[1]} xc:white".
" 1.jpg -geometry +20+125 -composite ".
" 2.jpg -geometry +140+205 -composite ".
" 3.jpg -geometry +250+205 -composite ".
" 4.jpg -geometry +360+205 -composite ".
" 5.jpg -geometry +470+205 -composite +repage";
exec("convert $cmd $new_image");
echo "File uploaded<br>";
}
else { ?>
<p>File to upload:</p>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<input type="file" name="filename" />
<input type="Submit" name="Submit" value="Submit" />
</form>
<?php }; ?>
gsmnaren
Posts: 7 Joined: 2011-01-02T06:46:35-07:00
Authentication code: 8675308
Post
by gsmnaren » 2011-01-03T04:35:25-07:00
Warning: exec() has been disabled for security reasons in /www/99k.org/s/t/e/XXXXX/htdocs/Profile Design/main page/upload.php on line 21
Warning: exec() has been disabled for security reasons in /www/99k.org/s/t/e/XXXXX/htdocs/Profile Design/main page/upload.php on line 30
File uploaded
Bonzo
Posts: 2971 Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Post
by Bonzo » 2011-01-03T05:07:10-07:00
How did you intend on running the code as you may be able to use Imagick which does not use exec( ) or Magickwand for php but I do not use them and so can not do an example.
If you want to use exec( ) you will either have to ask the hosts to allow it and confirm safe mode is off or change hosts.
Mistake in the code anyway as I forgot to escape the ( ) for linux.
Code: Select all
<?php
// If the form has been submitted do this
if ( isset( $_POST['Submit'] ) ){
// Temporary upload image name
$original_image = $_FILES['filename']['tmp_name'];
// Name to save the image as - in this case the same as the original
$new_image = $_FILES['filename']['name'];
$size = getimagesize ($original_image);
// crop out the images and save
$cmd = "$original_image -gravity northwest".
" \( +clone -crop 100x200+20+125 -write 1.jpg +delete \) ".
" \( +clone -crop 100x40+140+205 -write 2.jpg +delete \) ".
" \( +clone -crop 100x40+250+205 -write 3.jpg +delete \) ".
" \( +clone -crop 100x40+360+205 -write 4.jpg +delete \) ".
" -crop 100x40+470+220 5.jpg ";
exec("convert $cmd ");
$cmd = " -size {$size[0]}x{$size[1]} xc:white".
" 1.jpg -geometry +20+125 -composite ".
" 2.jpg -geometry +140+205 -composite ".
" 3.jpg -geometry +250+205 -composite ".
" 4.jpg -geometry +360+205 -composite ".
" 5.jpg -geometry +470+205 -composite +repage";
exec("convert $cmd $new_image");
echo "File uploaded<br>";
}
else { ?>
<p>File to upload:</p>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<input type="file" name="filename" />
<input type="Submit" name="Submit" value="Submit" />
</form>
<?php }; ?>
gsmnaren
Posts: 7 Joined: 2011-01-02T06:46:35-07:00
Authentication code: 8675308
Post
by gsmnaren » 2011-01-03T05:13:42-07:00
no also same error bro.....
add me in skype tool ID : rptnaren
Bonzo
Posts: 2971 Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Post
by Bonzo » 2011-01-03T06:04:53-07:00
I am afraid I do not use Skype or any chat programs and as I said if you want to use my php method you need to get exec( ) allowed and safe mode turned off.
There is system( ) and passthru( ) but I assume that if exec( ) is turned off they will be as well - exec is the prefered method.
There is Imagick which does not use exec( ) but you need to have that installed and I do not use it so you would need to work out your own code. It is not very well documented.
The php page for it is:
http://php.net/manual/en/book.imagick.php
I think this is the guy who is writing Imagick:
http://valokuva.org/?cat=1
I do not know how to run Freds scripts on the server without php but that is a possiblity if you can do that.
gsmnaren
Posts: 7 Joined: 2011-01-02T06:46:35-07:00
Authentication code: 8675308
Post
by gsmnaren » 2011-01-03T06:45:14-07:00
can u create like this for fbml script
Bonzo
Posts: 2971 Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Post
by Bonzo » 2011-01-03T06:57:02-07:00
can u create like this for fbml script
I can not but somebody may be able to - probably not here - but you could create another thread about that.
gsmnaren
Posts: 7 Joined: 2011-01-02T06:46:35-07:00
Authentication code: 8675308
Post
by gsmnaren » 2011-01-03T21:46:21-07:00
where i can create a new topic
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2011-01-03T21:49:07-07:00
click Developers at the top of the page ( or Return To Developers at the bottom of this page) and then click New Topic button.
userman
Posts: 12 Joined: 2010-09-12T10:58:46-07:00
Authentication code: 8675308
Post
by userman » 2011-01-26T05:07:34-07:00
Hi bonzo,
thanks, you script work for me!!! great work!!!
Can you recommend to me a script for modify the area crop?
http://www.hotscripts.com/blog/javascri ... g-scripts/
how can i select diferent area with the javascript image cropping scripts?
Regards.