Image::Size is fine, if size is the only thing, which matters. Sometimes, however, it isn’t enough, and when that is the case Image::Info (again fetched from CPAN) is your friend. Point it to a file (through various methods), and it will return a hash with all the information available about the image you pointed at. Most popular formats are supported.
#!/usr/bin/perl -w use strict; use Image::Info; # Just fetch the size my $imgInfo = Image::Info::image\_info("test.
Turning images is quite simple. In the example below an image is turned 90 degrees clockwise, wirtten to a file, turned another 90 degress and written to a file again.
#!/usr/bin/perl -w use strict; use Image::Magick; my $image = Image::Magick->new(magick=>'JPEG'); my $x = $image->Read('test.jpg'); $x = $image->Rotate(degrees=>90); # 90 degress clockwise $x = $image->Write('test.90.jpg'); $x = $image->Rotate(degrees=>90); # Another 90 degress clockwise $x = $image->Write('test.180.jpg'); exit();
If you’re working on heavy duty websites, knowing your database and how to use it best can make a world of difference in terms of performance, and thus you should always optimize the database. That’s pretty much obvious.
The tricky part is how you do the optimization? Often it requires a lot of reading up on how the database works - strengths, weaknesses and other details and loads of experience.
Mysql is a wonderful database, and while many use it, most people only scratch the surface of what the database can do. One of the practical functions available is the substring_index function, and an imaginary mailing list example is a nice way to show how to use it.
Let imagine we have a mailinglist in a table named “mailinglist” and it has a (char) column with the email addresses subscribed to the list.
Not all code are created equal. Some pieces of code are more important than others. The code that powers critical parts of a nuclear power plant is hopefully of a much higher standard than the code behind this site, but how do you recognize which quality of code you should aim for when developing websites?
A website may not have one set level for all content - usually the various pieces which make up the site (no matter if it be classes, files or functions - in PHP).