[wp-hackers] imgsize in upload.php
Dion Almaer
dion at almaer.com
Wed Feb 8 16:37:32 GMT 2006
Hi guys,
A small thing, but I always like my authors to put full height/width on
images that they upload, so I quickly hacked upload.php (in my blog platform
on WP 1.5, soon to be 2.0) to have:
---
if ( ereg('image/',$img1_type) ) {
list($width, $height, $type, $attr) =
getimagesize(get_settings('fileupload_realpath') . '/' . $img1_name);
$piece_of_code = '<img src="' . get_settings('fileupload_url') .'/'
. $img1_name . '" alt="' . $imgdesc . '" border="0" ' . $attr . '/>'; } else
{
$piece_of_code = "<a href='". get_settings('fileupload_url') .
"/$img1_name' title='$imgdesc'>$imgdesc</a>"; }
$piece_of_code = htmlspecialchars( $piece_of_code );
---
In general I try hard not to change any of the core files and use plugins
and hooks to make all changes. This was one that I had to make to the core,
so thought if people would prefer it... Maybe we could have it in there? :)
Cheers,
Dion Almaer
Founder, Ajaxian.com
http://ajaxian.com
Cleaning up the web with Ajax
More information about the wp-hackers
mailing list