Ticket #631 (closed Patch: wontfix)
Media Module - Images and others.
| Reported by: | dipunm | Owned by: | gregmac |
|---|---|---|---|
| Priority: | blocker | Milestone: | |
| Component: | Modules:Media | Version: | SVN HEAD |
| Keywords: | media, images, module, | Cc: |
Description
I was trying to get images to appear using the media controller and found that it had a bit of a bug. I managed to overcome it, but possibly you could rewite this to be more elegant. The code here makes sure that in the case that after extracting the extension, the file is still not found, it reverts to doing what it did before (just in case)
compare with _default function in \modules\media\controllers\media.php:
public function _default()
{
$type = $this->uri->segment(2);
$filename = $this->uri->segment(3);
// TODO: finish this for generic types
/* issues: getting View to work with any types of files */
$ext="";
$ext=explode('.',$filename);
if(is_array($ext)){
$fext = array_pop($ext);
$filename2 = implode('.',$ext);
try
{
$view = new View('media/'.$type.'/'.$filename2, NULL, $fext);
$view->render(TRUE);
}
catch (Kohana_Exception $exception)
{
try
{
$view = new View('media/'.$type.'/'.$filename);
}
catch (Kohana_Exception $exception)
{
Event::run('system.404');
}
}
}else{
try
{
$view = new View('media/'.$type.'/'.$filename);
}
catch (Kohana_Exception $exception)
{
Event::run('system.404');
}
}
}
Change History
Note: See
TracTickets for help on using
tickets.
