Re: Are there ways to resize pic without using CPAN modules
by mikeraz (Friar) on Jun 17, 2005 at 12:03 UTC
|
If the module Image::Magick is available you have that option, see this page for details. If the module is not available and the program is you can fall back to backtick processing
`convert $img_filename -resize ${tn_size}x$tn_size $tn_filename`
Be Appropriate && Follow Your Curiosity
| [reply] [d/l] |
Re: Are there ways to resize pic without using CPAN modules
by salva (Canon) on Jun 17, 2005 at 11:50 UTC
|
| [reply] |
Re: Are there ways to resize pic without using CPAN modules
by sgifford (Prior) on Jun 17, 2005 at 13:24 UTC
|
Why can't you simply install whatever modules you want under your home directory? I do this all the time with a variety of hosting providers. See Re^2: Perl module for a sample of how to do it if your provider doesn't provide shell access.
| [reply] |
|
GD is a little trickier to install than a Pure Perl module with no dependancies. First of all, GD depends on Math::Trig, so you would have to install that first. That is probably the smallest problem. The chances are that user 'nobody' or whatever user is used by the webserver, does not have privileges to use a c compiler. And then there is stuff like: $PREFIX = prompt('Where is libgd installed?','/usr/lib'); to catch.
So yes, pure perl modules can easilly be installed. Modules that require compilers are a little trickier. The easiest way for sure is to ask the admin to just install it for you.
--
b10m
All code is usually tested, but rarely trusted.
| [reply] [d/l] |
|
I agree that if you can convince your hosting company to install the module, that's the easiest (though not necessarily the fastest) way. If that's not possible for some reason, though, installing it yourself is a workable alternative.
With hosting companies I've used, I have never had a problem with the Web server user not having access to a compiler.
I'm surprised that GC has manual prompts like you describe with no documented way to override them. If that's the case, you can probably work around it by sending answers to it on STDIN. I agree this is tricky, and I also find it annoying.
| [reply] [d/l] |
|
| [reply] [d/l] |
|
| [reply] |
|
You need an appropriate use lib line to tell your script where to find the library. Something like:
use lib '/path/to/your/homedir/lib/perl5';
| [reply] [d/l] [select] |
Re: Are there ways to resize pic without using CPAN modules
by zentara (Archbishop) on Jun 17, 2005 at 16:03 UTC
|
The only problem with trying to install a pre-built binary like Image Magick(or a pre-built perl xs module) to your home directory, is making sure it will match up with the c libs installed. An elf executable compiled on one linux platform will not necessarily run on another.I would say you would be better off doing the resizing on your local machine, and then uploading it.
I'm not really a human, but I play one on earth.
flash japh
| [reply] |
Re: Are there ways to resize pic without using CPAN modules
by JupiterCrash (Monk) on Jun 17, 2005 at 15:46 UTC
|
Without using any modules, if you could atleast get the Image::Magick binary distribution installed into your own directory, you could do a system call to the 'mogrify' utility to resize an image:
See example usage of the 'mogrify' binary here:
http://www.imagemagick.org/script/mogrify.php
Matt
| [reply] |
Re: Are there ways to resize pic without using CPAN modules
by Anonymous Monk on Jun 17, 2005 at 12:21 UTC
|
So, you have a provider that allows you to install Perl programs, but not Perl modules? Considering that you can use a module as a program, and a program as a module, that shouldn't stop you from installing a module. Or else, shell out to the tool that does the cropping. Or lift the code from a module that you want to use, and put it in your code.
Of course, I could tell you how - but that would be in the form of another module.... | [reply] |
Re: Are there ways to resize pic without using CPAN modules
by TedPride (Priest) on Jun 17, 2005 at 15:52 UTC
|
If you don't mind batch processing the images instead of real time resizes, you could theoretically Net::FTP the images to your disk, resize them with modules installed on your own system, then Net::FTP them back. | [reply] |