Title: Thumbnail html code with Upload
Last modified: August 18, 2016

---

# Thumbnail html code with Upload

 *  [panic42](https://wordpress.org/support/users/panic42/)
 * (@panic42)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/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"; };

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [earcos](https://wordpress.org/support/users/earcos/)
 * (@earcos)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/thumbnail-html-code-with-upload/#post-142797)
 * patch: **** malformed patch at line 4: require_once(‘../wp-includes/wp-l10n.php’);
 *  [morgs](https://wordpress.org/support/users/morgs/)
 * (@morgs)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/thumbnail-html-code-with-upload/#post-143230)
 * Hello,
 * I think this might be what I am looking for but not sure how to implement it.
 * Can you tell me?
 * Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Thumbnail html code with Upload’ is closed to new replies.

 * 2 replies
 * 3 participants
 * Last reply from: [morgs](https://wordpress.org/support/users/morgs/)
 * Last activity: [21 years, 1 month ago](https://wordpress.org/support/topic/thumbnail-html-code-with-upload/#post-143230)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
