Ir para conteúdo
Fórum Script Brasil
  • 0

Imagem em vez de ícone php


gutierry

Pergunta

Tenho um código de um arquivo php aqui, é um sistema de upload de arquivos, ele pega a extensão dos arquivos por grupos e deixa com um determinado ícone de html5, gostaria de poder alterar todos os tipos de arquivos, em vez de ser por grupo, ser por extensão, cada extensão uma imagem escolhida por mim.

/* ++++++++++ ARCHIVE ++++++++++ */
$_IMAGES["archive"] = "fa-archive";

$_IMAGES["7z"] = $_IMAGES["archive"];
$_IMAGES["as"] = $_IMAGES["archive"];
$_IMAGES["bz2"] = $_IMAGES["archive"];
$_IMAGES["c"] = $_IMAGES["archive"];
$_IMAGES["cab"] = $_IMAGES["archive"];
$_IMAGES["cpp"] = $_IMAGES["archive"];
$_IMAGES["cs"] = $_IMAGES["archive"];
$_IMAGES["gz"] = $_IMAGES["archive"];
$_IMAGES["h"] = $_IMAGES["archive"];
$_IMAGES["rar"] = $_IMAGES["archive"];
$_IMAGES["rb"] = $_IMAGES["archive"];
$_IMAGES["sln"] = $_IMAGES["archive"];
$_IMAGES["tar"] = $_IMAGES["archive"];
$_IMAGES["tgz"] = $_IMAGES["archive"];
$_IMAGES["zip"] = $_IMAGES["archive"];

Como tem que ficar o código?

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

O que usa imagem lá em vez de ícones foi eu que alterei, mas lá é apenas css, já pra mudar esses ícones de acordo com a extensão do arquivo é necessário alterar o arquivo php em si, aqui está o código de todo o arquivo (note que para cada grupo de extensões é um ícone html5 diferente): 

	<?php
	$_IMAGES = array();
	$_IMAGES["arrow_down"] = "fa-arrow-down";
$_IMAGES["arrow_up"] = "fa-arrow-up";
$_IMAGES["del"] = "fa-times";
$_IMAGES["directory"] = "fa-folder";
$_IMAGES["unknown"] = "fa-question";
$_IMAGES["pdf"] ="fa-file-pdf-o";
	/* ++++++++++ IMAGES PREVIEW ++++++++++ */
$_IMAGES["image"] = "fa-picture-o";
	$_IMAGES["jpg"] = $_IMAGES["image"];
$_IMAGES["mp4"] = $_IMAGES["image"];
$_IMAGES["jpeg"] = $_IMAGES["image"];
$_IMAGES["png"] = $_IMAGES["image"];
$_IMAGES["gif"] = $_IMAGES["image"];
	/* ++++++++++ IMAGES ++++++++++ */
$_IMAGES["image-file"] = "fa-file-image-o";
	$_IMAGES["graphics"] = $_IMAGES["image-file"];
$_IMAGES["vectorgraphics"] = $_IMAGES["image-file"];
$_IMAGES["psd"] = $_IMAGES["image-file"];
$_IMAGES["xcf"] = $_IMAGES["image-file"];
$_IMAGES["odg"] = $_IMAGES["image-file"];
$_IMAGES["tif"] = $_IMAGES["image-file"];
$_IMAGES["tiff"] = $_IMAGES["image-file"];
$_IMAGES["ai"] = $_IMAGES["image-file"];
$_IMAGES["eps"] = $_IMAGES["image-file"];
$_IMAGES["svg"] = $_IMAGES["image-file"];
$_IMAGES["art"] = $_IMAGES["image-file"];
	/* ++++++++++ FONT FILES ++++++++++ */
$_IMAGES["fonts"] = "fa-font";
	$_IMAGES["fnt"] = $_IMAGES["fonts"];
$_IMAGES["fon"] = $_IMAGES["fonts"];
$_IMAGES["otf"] = $_IMAGES["fonts"];
$_IMAGES["ttf"] = $_IMAGES["fonts"];
$_IMAGES["woff"] = $_IMAGES["fonts"];
$_IMAGES["acfm"] = $_IMAGES["fonts"];
$_IMAGES["amfm"] = $_IMAGES["fonts"];
$_IMAGES["bdf"] = $_IMAGES["fonts"];
$_IMAGES["dfont"] = $_IMAGES["fonts"];
$_IMAGES["fot"] = $_IMAGES["fonts"];
$_IMAGES["gdr"] = $_IMAGES["fonts"];
$_IMAGES["pfa"] = $_IMAGES["fonts"];
$_IMAGES["pfb"] = $_IMAGES["fonts"];
$_IMAGES["pfm"] = $_IMAGES["fonts"];
$_IMAGES["pfr"] = $_IMAGES["fonts"];
	/* ++++++++++ TEXT FILES ++++++++++ */
$_IMAGES["txt"] = "fa-file-text-o";
	$_IMAGES["odt"] = $_IMAGES["txt"];
$_IMAGES["rtf"] = $_IMAGES["txt"];
$_IMAGES["log"] = $_IMAGES["txt"];
$_IMAGES["msg"] = $_IMAGES["txt"];
$_IMAGES["pages"] = $_IMAGES["txt"];
$_IMAGES["tex"] = $_IMAGES["txt"];
$_IMAGES["wpd"] = $_IMAGES["txt"];
$_IMAGES["wps"] = $_IMAGES["txt"];
$_IMAGES["abw"] = $_IMAGES["txt"];
$_IMAGES["eml"] = $_IMAGES["txt"];
	/* ++++++++++ WORD FILES ++++++++++ */
$_IMAGES["doc"] = "fa-file-word-o";
	$_IMAGES["dot"] = $_IMAGES["doc"];
$_IMAGES["docx"] = $_IMAGES["doc"];
$_IMAGES["docm"] = $_IMAGES["doc"];
$_IMAGES["dotx"] = $_IMAGES["doc"];
$_IMAGES["dotm"] = $_IMAGES["doc"];
	/* ++++++++++ VIDEO ++++++++++ */
$_IMAGES["video"] = "fa-film";
	$_IMAGES["avi"] = $_IMAGES["video"];
$_IMAGES["mov"] = $_IMAGES["video"];
$_IMAGES["mpeg"] = $_IMAGES["video"];
$_IMAGES["mpg"] = $_IMAGES["video"];
$_IMAGES["mkv"] = $_IMAGES["video"];
$_IMAGES["wmv"] = $_IMAGES["video"];
$_IMAGES["mp4"] = $_IMAGES["video"];
$_IMAGES["ogv"] = $_IMAGES["video"];
$_IMAGES["webm"] = $_IMAGES["video"];
$_IMAGES["3g2"] = $_IMAGES["video"];
$_IMAGES["3gp"] = $_IMAGES["video"];
$_IMAGES["m4v"] = $_IMAGES["video"];
$_IMAGES["swf"] = $_IMAGES["video"];
$_IMAGES["divx"] = $_IMAGES["video"];
$_IMAGES["f4v"] = $_IMAGES["video"];
$_IMAGES["rm"] = $_IMAGES["video"];
$_IMAGES["vob"] = $_IMAGES["video"];
$_IMAGES["flv"] = $_IMAGES["video"];
$_IMAGES["ogg"] = $_IMAGES["video"];
$_IMAGES["drc"] = $_IMAGES["video"];
$_IMAGES["gifv"] = $_IMAGES["video"];
$_IMAGES["qt"] = $_IMAGES["video"];
$_IMAGES["mxf"] = $_IMAGES["video"];
$_IMAGES["nsv"] = $_IMAGES["video"];
$_IMAGES["f4p"] = $_IMAGES["video"];
$_IMAGES["f4a"] = $_IMAGES["video"];
$_IMAGES["f4b"] = $_IMAGES["video"];
	/* ++++++++++ PRESENTATION ++++++++++ */
$_IMAGES["presentation"] = "fa-th-large";
	$_IMAGES["odp"] = $_IMAGES["presentation"];
$_IMAGES["pps"] = $_IMAGES["presentation"];
$_IMAGES["ppsx"] = $_IMAGES["presentation"];
$_IMAGES["ppt"] = $_IMAGES["presentation"];
$_IMAGES["pptx"] = $_IMAGES["presentation"];
$_IMAGES["pot"] = $_IMAGES["presentation"];
$_IMAGES["potx"] = $_IMAGES["presentation"];
$_IMAGES["potm"] = $_IMAGES["presentation"];
$_IMAGES["pub"] = $_IMAGES["presentation"];
	/* ++++++++++ SPREADSHEET ++++++++++ */
$_IMAGES["spreadsheet"] = "fa-table";
	$_IMAGES["xls"] = $_IMAGES["spreadsheet"];
$_IMAGES["xlt"] = $_IMAGES["spreadsheet"];
$_IMAGES["xlm"] = $_IMAGES["spreadsheet"];
$_IMAGES["xlsx"] = $_IMAGES["spreadsheet"];
$_IMAGES["xlsm"] = $_IMAGES["spreadsheet"];
$_IMAGES["xltx"] = $_IMAGES["spreadsheet"];
$_IMAGES["xltm"] = $_IMAGES["spreadsheet"];
$_IMAGES["ods"] = $_IMAGES["spreadsheet"];
	/* ++++++++++ AUDIO ++++++++++ */
$_IMAGES["audio"] = "fa-music";
	$_IMAGES["mp3"] = $_IMAGES["audio"];
$_IMAGES["wav"] = $_IMAGES["audio"];
$_IMAGES["wma"] = $_IMAGES["audio"];
$_IMAGES["amr"] = $_IMAGES["audio"];
$_IMAGES["aif"] = $_IMAGES["audio"];
$_IMAGES["iff"] = $_IMAGES["audio"];
$_IMAGES["m3u"] = $_IMAGES["audio"];
$_IMAGES["m4a"] = $_IMAGES["audio"];
$_IMAGES["mid"] = $_IMAGES["audio"];
$_IMAGES["mpa"] = $_IMAGES["audio"];
$_IMAGES["ra"] = $_IMAGES["audio"];
$_IMAGES["aa3"] = $_IMAGES["audio"];
$_IMAGES["acm"] = $_IMAGES["audio"];
$_IMAGES["afc"] = $_IMAGES["audio"];
$_IMAGES["ape"] = $_IMAGES["audio"];
$_IMAGES["at3"] = $_IMAGES["audio"];
$_IMAGES["caf"] = $_IMAGES["audio"];
$_IMAGES["flac"] = $_IMAGES["audio"];
$_IMAGES["m4b"] = $_IMAGES["audio"];
$_IMAGES["m4r"] = $_IMAGES["audio"];
$_IMAGES["midi"] = $_IMAGES["audio"];
$_IMAGES["mxl"] = $_IMAGES["audio"];
$_IMAGES["ogg"] = $_IMAGES["audio"];
$_IMAGES["pcast"] = $_IMAGES["audio"];
$_IMAGES["snd"] = $_IMAGES["audio"];
$_IMAGES["3ga"] = $_IMAGES["audio"];
$_IMAGES["ac3"] = $_IMAGES["audio"];
	/* ++++++++++ EBOOKS ++++++++++ */
$_IMAGES["epub"] = "fa-book";
	$_IMAGES["azw"] = $_IMAGES["epub"];
$_IMAGES["mobi"] = $_IMAGES["epub"];
	/* ++++++++++ CODE ++++++++++ */
$_IMAGES["code"] = "fa-code";
	$_IMAGES["css"] = $_IMAGES["code"];
$_IMAGES["iso"] = $_IMAGES["code"];
$_IMAGES["java"] = $_IMAGES["code"];
$_IMAGES["js"] = $_IMAGES["code"];
$_IMAGES["php"] = $_IMAGES["code"];
$_IMAGES["xml"] = $_IMAGES["code"];
$_IMAGES["json"] = $_IMAGES["code"];
	/* ++++++++++ EXEC ++++++++++ */
$_IMAGES["exec"] = "fa-hdd-o";
	$_IMAGES["exe"] = $_IMAGES["exec"];
$_IMAGES["dmg"] = $_IMAGES["exec"];
	/* ++++++++++ DATABASE ++++++++++ */
$_IMAGES["database"] = "fa-database";
	$_IMAGES["db"] = $_IMAGES["database"];
$_IMAGES["dbf"] = $_IMAGES["database"];
$_IMAGES["mdb"] = $_IMAGES["database"];
$_IMAGES["sql"] = $_IMAGES["database"];
$_IMAGES["sqlite"] = $_IMAGES["database"];
$_IMAGES["accdb"] = $_IMAGES["database"];
 
/* ++++++++++ WEB PAGE ++++++++++ */
$_IMAGES["webpage"] = "fa-globe";
	$_IMAGES["htm"] = $_IMAGES["webpage"];
$_IMAGES["html"] = $_IMAGES["webpage"];
	/* ++++++++++ ARCHIVE ++++++++++ */
$_IMAGES["archive"] = "fa-archive";
	$_IMAGES["7z"] = $_IMAGES["archive"];
$_IMAGES["as"] = $_IMAGES["archive"];
$_IMAGES["bz2"] = $_IMAGES["archive"];
$_IMAGES["c"] = $_IMAGES["archive"];
$_IMAGES["cab"] = $_IMAGES["archive"];
$_IMAGES["cpp"] = $_IMAGES["archive"];
$_IMAGES["cs"] = $_IMAGES["archive"];
$_IMAGES["gz"] = $_IMAGES["archive"];
$_IMAGES["h"] = $_IMAGES["archive"];
$_IMAGES["rar"] = $_IMAGES["archive"];
$_IMAGES["rb"] = $_IMAGES["archive"];
$_IMAGES["sln"] = $_IMAGES["archive"];
$_IMAGES["tar"] = $_IMAGES["archive"];
$_IMAGES["tgz"] = $_IMAGES["archive"];
$_IMAGES["zip"] = $_IMAGES["archive"];
	/* ++++++++++ ANDROID ++++++++++ */
$_IMAGES["apk"] = "fa-android";
?>
	

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...