image magick and mogrify

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Can anyone give me some simple function for resizing images and
thumbnail creation with image magick (I can't install GD2 on my Mac (OSX

I have functional upload function (well, not function, but part of
script...) and now I need to create thumbnails. but how?

I think I will use this set of lines:

$smal = "150";
$newtmb = "mogrify -thumbnail x $phfile";

I think I have to copy files to new location. new location is "tmb"
directory inside of users dir. (complete path will be:
so, in thumb function I will need a copy line? maybe like this:

copy($phfile1, $phfile2);

and where to describe to my script what is new, what old $phfile?

$phfile1 = "$sitepath/$galerpath/$uname/$phfile";
$phfile2 = "$sitepath/$galerpath/$uname/tmb/$phfile";

so, for my function... will it be something like this:

function photo_thumbnail() {
  global MOGRIFY,$sitepath,$galerpath,$uname,$phfile;
  $blabla = copy($phfile1, $phfile2);
  $newtmb = "mogrify -thumbnail x $phfile";

I'm afraid it won't work... but I hope I'm not far from the solution...

here is my upload part:

if ($send) {
  $query = "SELECT uname FROM user_basic WHERE uid='$uid'";
  $result = mysql_query ($query) or die ("Query failed ($query)");
  list($uname) = mysql_fetch_array($result);
  $uploaddir = "$sitepath/$galerpath/$uname/";
  $names = array($name_photo['numbr']['photo_name']);
  while (list($key,$phfile) = each($_FILES['userfile']['name'])) {
    $uploadfile = $uploaddir . basename($phfile);
    if (move_uploaded_file($_FILES['userfile']['tmp_name'][$key],
$uploadfile)) {
      echo "file [$phfile] uploaded";
      mysql_query("INSERT INTO slike (ph_name,ph_file,ph_txt,uid) VALUES
    } else {
      echo "$uid - something is wrong";

can anyone help me with this? (not to mention that I will need later
some size check of uploaded image... but this one is more important. and
than double names... ouch...)

Jan ko?

Site Timeline