Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Attachment Extension 1.4
This discussion has been closed.
Comments
when I try to create a new discussion and I don't put a topic in the textfield usually i get a warning, but when a attachment is selected i get the follwing error:
Trying to get property of non-object in \htdocs\v\extensions\Attachments\default.php on line 303
jazzman, now that's an even more useful usage scenario :-)
i can't upload a file called TEST.JPG because it's JPG and not jpg
i also wasn't able to upload a ZIP because Firefox sent a 'application/download' and not a 'application/zip', when I add application/download in the settings it works.
edit: now it works well, hm... maybe it's my fault
in Attachments/default.php, look for the GetAttachmentsString function.
change the first few lines of the foreach loop from this:
foreach( $files as $file ) { $filename = substr(strstr(basename($file), "."), 1); $s .= "<li id=\"".$CommentID."_".$filename."\"><a href=\"".GetUrl($Context->Configuration, 'comments.php') . "?CommentID=" .$CommentID. "&Download=" .urlencode($filename). "\">". $filename ."</a>";
to this:
foreach( $files as $file ) { $filename = substr(strstr(basename($file), "."), 1); if(in_array(strtolower(substr($filename,-3,3)),array('gif','jpg','png'))) { $absfilename = $Context->Configuration['APPLICATION_PATH'] . "uploads/{$CommentID}.{$filename}"; $relfilename = $Context->Configuration['WEB_ROOT'] . "uploads/{$CommentID}.{$filename}"; $size = (list($width, $height, $type, $attr) = getimagesize($absfilename)) ? "style=\"width:{$width}px; height:{$height}px; border:0\" " : ""; $s .= "<li id=\"".$CommentID."_".$filename."\"><img src=\"$relfilename\" $size/><br />\n"; } else { $s .= "<li id=\"".$CommentID."_".$filename."\"><a href=\"".GetUrl($Context->Configuration, 'comments.php') . "?CommentID=" .$CommentID. "&Download=" .urlencode($filename). "\">". $filename ."</a></li>\n"; }
just a quick hack, like i said.
of course an image will probably look weird inside a <ul>, but i took the ul (and the attachments div) out of my own version and just list the files with linebreaks.