Upload HTML Modifications
Question
How do I modify the HTML code that is used for uploaded files?
Answer
You can make changes to the page in which popup images display by modifying the Uploaded Image Popup Template, listed on the Templates : System tab1.
If you wish to make changes to the HTML which appears in the Entry Body field for the uploaded image, this must be done directly in the Movable Type source code.
Please note that you must be comfortable with Perl in order to make these changes, as support staff cannot provide assistance with modifications to the underlying Movable Type code, nor for any problems which result from such modifications.
Look in lib/MT/App/CMS.pm, in the code for the _process_post_upload method, for the section which looks similar to this (» indicates line breaks added for display purposes):
my $link = $thumb ? qq(<img src="$thumb"»
width="$thumb_width" height="$thumb_height"»
border="0" />) : "View image";
return <<HTML;
<a href="$url" onclick="window.open('$url','popup','width=$width,»
height=$height,scrollbars=no,resizable=no,toolbar=no,»
directories=no,location=no,menubar=no,status=no,left=0,top=0');
return false">$link</a>
HTML
} elsif ($q->param('include')) {
(my $fname = $url) =~ s!^.*/!!;
if ($thumb) {
return <<HTML;
<a href="$url"><img alt="$fname" src="$thumb" width="$thumb_width"»
height="$thumb_height" /></a>
HTML
} else {
return <<HTML;
<img alt="$fname" src="$url" width="$width" height="$height" />
HTML
}
} elsif ($q->param('link')) {
return <<HTML;
<a href="$url">Download file</a>
HTML
}
If you decide to attempt changes to the code, please remember to always save a backup copy of the file before doing so, in case you need to restore the original code.
1 In versions prior to 3.2, these are listed under Special Templates on the Templates menu.


