473,387 Members | 1,398 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,387 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 2302

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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.