Thumbnail html code with Upload
-
Hi,
i don’t know if somebody has done this already. Here is a little patch so a nicer html code is outputted when wordpress creates thumbnails.
And a fix for the alt tag not filled in, if register_globals is off.
--- wordpress/wp-admin/upload.php Wed Dec 15 20:41:49 2004
+++ upload.php Wed Feb 9 14:30:02 2005
@@ -2,6 +2,7 @@
require_once('../wp-includes/wp-l10n.php');$title = 'Upload Image or File';
+$imgdesc = $_POST['imgdesc'];require_once('admin-header.php');
@@ -195,16 +196,20 @@
$max_side = intval($_POST['imgthumbsizecustom']);
}- $result = wp_create_thumbnail($pathtofile, $max_side, NULL);
- if($result != 1) {
- print $result;
+ $thumb_result = wp_create_thumbnail($pathtofile, $max_side, NULL);
+ if($thumb_result != 1) {
+ print $thumb_result;
}
}if ( ereg('image/',$img1_type)) {
- $piece_of_code = "<img src="". get_settings('fileupload_url') ."/$im
g1_name" alt="$imgdesc" />";
+ if ($thumb_result == 1) {
+ $piece_of_code = "<a href="". get_settings('fileupload_url') ."/$im
g1_name"><img src="". get_settings('fileupload_url') ."/thumb-$im
g1_name" alt="$imgdesc" />";
+ } else {
+ $piece_of_code = "<img src="". get_settings('fileupload_url') ."/$i
mg1_name" alt="$imgdesc" />";
+ }
} else {
$piece_of_code = "<a href="". get_settings('fileupload_url') . "/$im
g1_name" title="$imgdesc" />$imgdesc";
};
- The topic ‘Thumbnail html code with Upload’ is closed to new replies.