473,239 Members | 1,461 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,239 software developers and data experts.

image magick and mogrify

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
--
Jul 17 '05 #1
0 2295

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ming | last post by:
Hi All, I want to write a PHP webpage which allows people to upload images (no matter what formats) to me and at the same time converts any non-jpeg image to JPEG. Here's what I have: ...
1
by: Phil Powell | last post by:
$mogResponse = exec("mogrify -size ${width}x$height " . $this->locationPath . '/' . $this->fileName . ' -resize ' . $width . "x$height > +profile " . $this->thumbLocationPath . '/' ....
2
by: Eric McDaniel | last post by:
I am trying to read in a bunch of images and manipulate them using Image::Magick, then display them using Tk::Photo. I would like to do this without creating a temp file for each image, since there...
3
by: Weapons of Mass Destruction | last post by:
Can anyone tell me why Image::Magick isn't loading? I keep getting the following error: Can't load 'd:/home/d83921/cgi-bin/photo/magick/Magick.dll' for module Image::Magick: load_file:The...
9
by: zacariaz | last post by:
I dont know, and i dont much like javascript, however, i am told that the only way to do want i want to do, is with javascript, so here goes. zoom and cut is the only features i need. 1. the...
9
by: rahatekarabhijeet | last post by:
I downloaded the sorce from CPAN(PerlMagick-6.32.tar.gz). I followed the normal procedure to install perl module on unix platform, i.e. 1) perl Makefile.PL during the execution of this command i...
1
by: Freedolen | last post by:
Hi, Iam new to this forum. I need to find the given TIFF image is in CMYK or RGB. Though i have checked with Image::Magick, and used: my $img = new Image::Magick; $img->Read("Sample.tif");...
6
by: chetan | last post by:
can anyone give me a small program in C++ which would open a specified image file(jpg, gif, etc.,) in any windows application.
1
by: amative | last post by:
Hi all, Can any one tell me pls how we can implement Image Magick with asp.net. I have download image magick dll file from: http://midimick.com/magicknet/magickDoc.html I want to resize the...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.