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
v.10.3.5))?
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 {$smal}x{$smal} $phfile";
I think I have to copy files to new location. new location is "tmb"
directory inside of users dir. (complete path will be:
$sitepath/$galerpath/$uname/tmb/)
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 {$smal}x{$smal} $phfile";
`$newtmb`;
}
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/";
reset($_FILES['userfile']['name']);
$names = array($name_photo['numbr']['photo_name']);
reset($names);
print_r($names);
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
('$ph_name','$ph_file','$ph_txt','$uid'");
} else {
echo "$uid - something is wrong";
print_r($_FILES);
}
}
}
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?
http://fotozine.org
--