CREATE OR REPLACE VIEW vw_manuales_img AS select `manuales_img`.`id` AS `id`,`manuales_img`.`id_media` AS `id_media`,`manuales_img`.`id_manual` AS `id_manual`,`manuales_img`.`leyenda` AS `leyenda`,`manuales_img`.`orden` AS `orden`,`manuales_img`.`principal` AS `principal`,`media_files`.`type` AS `type`,`media_files`.`name` AS `name`,`media_files`.`filename` AS `filename`,`media_files`.`extension` AS `extension`,`media_files`.`size` AS `size`,`media_files`.`mime` AS `mime`,`media_files`.`mime_download` AS `mime_download`,`media_files`.`download_code` AS `download_code`,`media_files`.`width` AS `width`,`media_files`.`height` AS `height`,replace(if((`media_files`.`size` > ((1024 * 1024) * 1024)),concat(round((`media_files`.`size` / ((1024 * 1024) * 1024)),2),'Gb'),if((`media_files`.`size` > (1024 * 1024)),concat(round((`media_files`.`size` / (1024 * 1024)),2),'Mb'),if((`media_files`.`size` > 1024),concat(round((`media_files`.`size` / 1024),2),'Kb'),concat(`media_files`.`size`,'b')))),'.',',') AS `size_formatted` from (`manuales_img` join `media_files` on((`manuales_img`.`id_media` = `media_files`.`id`)))