I've never used GD, so I won't comment on your code, but I do know my image editing.
If your script isn't outputting any errors, and the final image does "slightly resemble the source file", it may be a problem in the way you're resizing, rather than any errors in the code you're using.
I'll explain:
If the original image is significantly larger than the final thumbnail, then you may need to resize it in two or three steps, to maintain image quality.
I personally don't like to reduce an image by more than 25% in one pass, particularly if the final image is very small (and 150x150 is quite small).
I can't provide GD specific code for this, but what I suggest you could do is something like this,
(Please note, this is not real code, this is to explain the theory to you)
open image;
get image_width;
if (image_width > (150 * 4)) {
change_image_size to "25%";
}
change_image_size to final_thumbnail_size;
print_image;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.