Sponsored by Dragon Age: Origins
Can't get enough Dragon Age: Origins? Play the flash game. view!
DragonAgeJourneys.com - Play the free companion flash game to Dragon Age: Origins.
38 Comments
- MoneyShot, on 10/12/2007, -1/+21The first five comments are brand new accounts and/or accounts that have only dugg m0nkeymafia's submissions. Ditto with the majority of the diggers.
Bury this f-er and start banning the scammers! - Louis11, on 10/12/2007, -5/+19There are literally hundreds of tutorials like this on the web... what sets this one apart from all the rest? Just use the GD Library and you're set... Definitely not Digg worthy.
- Otto, on 10/12/2007, -0/+11halik: Yes, those functions use the gd library for all the actual manipulation, which is compiled to native binary code.
- adolfojp, on 10/12/2007, -0/+7On the next Digg: How to use google to search for PHP tutorials. More at 11.
- Otto, on 10/12/2007, -0/+5A better resource: The manual. See http://php.net/gd for all you could want to know.
- inactive, on 10/12/2007, -0/+4You're better off using something like ImageMagick so you can accept uploaded files in almost any format and then convert them to jpg|png|gif.
- inkhead, on 10/12/2007, -0/+4Just freaking use phpthumb.... It's a whole library dedicated to this sort of thing, with watermarking, flipping based on EXIF data, and you can just tag it on an normal
- gauthierm, on 10/12/2007, -0/+3Since you're worth your salt, you must already know about the imagick PECL extension:
http://pecl.php.net/package/imagick - inactive, on 10/12/2007, -0/+3@mpancha
would u rather have more information when you dont need it, or less information when you need it?
damned if u do, damned if u dont - infm, on 10/12/2007, -0/+2Sure threes lots on there, but if someone thinks it's digg worthy, and then at least the first 5 people to comment also thing that it's digg worthy then maybe..... it is digg worthy. I thought it was interesting.
- RidinDirty, on 10/12/2007, -0/+2Wow this site is really starting to fill up with spam.
"wow this is like the most amazing and detailed tutorial I've seen for a long time, well presented and very helpful."
Gimme a friggin' break. - neoform, on 10/12/2007, -3/+5Louis11:
What IS digg worthy? most stuff on digg these days is trash anyway..
jgc7:
You clearly can't code PHP, since you didn't notice that this is used:
if (@is_uploaded_file($_FILES["userfile"]["tmp_name"])) - MeatBiProduct, on 10/12/2007, -1/+3What sets it apart is that this code fails to alias the image or us anytype of bicubic resampling. Producing resized lower quality images.
- deanshultz, on 10/12/2007, -2/+4everyone's a critic.
give the guy credit for contributing instead of complaining...
furthermore, while there may be more succinct or fancy ways to accomplish this, it may be just what some newbie needs. - inkhead, on 10/12/2007, -0/+2Use PHPThumb, it has everything, even caching and inline use, so you can use it right in the IMG tag with variables on the end of your image. It is absolutely fantastic!
http://phpthumb.sourceforge.net/ - rheaume, on 10/12/2007, -0/+1Ever try resizing pictures on PCP man?
- ph3rny, on 10/12/2007, -0/+1doesn't the imagecreatefromstring() method work better than using if statements for jpg, png, and gif?
edit: due to the fact that it can accept like almost every image type and convert it to jpg, png, and gif - boiss, on 10/12/2007, -0/+1never use the copy() function when copying an uploaded file, always use move_uploaded_file() to avoid the null byte (x00) hack in the file name
- ada80ro, on 10/12/2007, -0/+1The php manual has a code sample for resizing an image proportionally:
Example 2. Resampling an image proportionally
http://www.php.net/manual/en/function.imagecopyresampled.php - neoform, on 10/12/2007, -0/+1If the file isn't an image, php will return false when the function is run.
- mpancha, on 10/12/2007, -2/+3Google does give a lot of useless results as well. Its kind of nice that someone did take the time out to get off their horse and help us peasants down here seeking somethign like this.
- ph3rny, on 10/12/2007, -0/+1if(getimagesize($src_img)) {
imagecreatefromstring($src_img);
} else {
exit('Invalid: Not an image');
}
should do the trick? - digital1, on 10/12/2007, -0/+1Provide a this feature through an Ajax Widget: checkout http://rockstarapps.com/wordpress/?p=22, for a good write up on ajax image manipulation
- greyfade, on 10/12/2007, -0/+1a waste of the internets. i'll care about posts like this when they announce ImageMagick library integration into PHP.
of course any PHP developer worth his salt already knows this *****. - halik, on 10/12/2007, -3/+3I really hope those libraries are done in native binary, because anyone doing this in pure php is an idiot.
- brendandonhue, on 10/12/2007, -0/+0@neoform - your comment is right, my last post was wrong
@ph3rny - that could introduce errors because getimagesize() returns true for some filetypes that aren't supported by imagecreatefromstring() (TIFF, SWF, etc.) - mattvilla, on 10/12/2007, -0/+0The article is missing more advanced image manipulation techniques. The content of this article appears to only cover the basics of resizing the geometry of the image. But, it doesn’t specify other techniques that can be helpful when resizing images such as converting DPI or colorspace, specifying compression quality level or trimming image edges.
- caracasphp, on 10/12/2007, -0/+0MMMM ill try it out
- stoyan, on 10/12/2007, -0/+0And my two cents on the proportional image resizing in PHP - PEAR::Image_Transform. Example here: http://www.phpied.com/laziest-image-resize-in-php/
- brendandonhue, on 10/12/2007, -1/+0The switch statement on the type returned by getimagesize() is used for security reasons (ensures that the file uploaded is actually an image.)
- jshusta, on 10/12/2007, -2/+0that must be why it's "read the ***** tutorial" and not "read the ***** manual."
oh. blast. - mpancha, on 10/12/2007, -4/+1The manual often has too much info, and doesn't get straight to the point.
At least that has been my experience with the php.net manual. In other words, for those trying to learn, the manual is pathetic. - amikael9999, on 10/12/2007, -6/+0Well, just touch one point:
http://freecomputerbooks.com/webPhpBooksIndex.html - jgc7, on 10/12/2007, -13/+1I agree. Let's see. If the file is called "/etc/passwd" and I change the form name to "~/html/"
I wonder how much longer this script will continue to work. - JobiTheJuan, on 10/12/2007, -25/+5wow this is like the most amazing and detailed tutorial I've seen for a long time, well presented and very helpful.
- TomskiBOTN, on 10/12/2007, -25/+4Great stuff fella been trying to figure this out for ages withought having to resize with PS thanks again buddy :)
- Usowicz, on 10/12/2007, -28/+5Cool! Just what I was looking for.
- Parariddle, on 10/12/2007, -27/+4Great article good work mate !


What is Digg?