1

Tengo una imagen en una base de datos SQL pero esta con formato hexadecimal, quiero mostrarla en una pagina HTML con PHP, pero no he podido.

La imagen es esta :

0x424D72320100000000003600000028000000BB0000008B00000001001800000000003C32010000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000FFFFFFFEFEFEFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFF000000000000000000000000000000FFFFFFFFFFFFFEFEFEFFFFFF000000000000000000000000000000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFF000000FFFFFF000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000FFFFFF000000000000FFFFFFFFFFFFFFFFFF000000FEFEFEFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFF000000000000FFFFFF000000FFFFFF000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFF
4
  • 1
    ¿Que has intentado? ¿Como conviertes la imagen a hexadecimal? ¿Cual es el formato de la imagen? ¿El campo de la DB donde guardas la imagen es lo suficientemente grande para que entre la cadena? A priori, la cadena no es una cadena hexadecimal válida.
    – Marcos
    Commented el 9 ago. 2019 a las 14:39
  • no la canvierto, el campo en la base de datos es (image) cuando hago la consulta me muestra la cadena que coloque en la pregunta, y la cadena es mucho mas larga, no tengo mucha experiencia en este tema, y pues necesito hacer la consulta y colocar la imagen en un html.
    – FRANCORALF
    Commented el 9 ago. 2019 a las 15:12
  • 1
    Cuando pregunto como la conviertes, me refería a ¿como haces para leer la imagen y guardarla en la DB? Si la cadena es más grande puedes usar servicios como pastebin.com para compartirla en su totalidad. Por favor, intenta responder a las demás preguntas. Usa la opción de editar y agrega dicha información en la pregunta.
    – Marcos
    Commented el 9 ago. 2019 a las 15:22
  • Marcos muchas gracias, lo que pasa es que las imagenes ya estan ahi, soy nuevo en el trabajo y la base de datos ya lleva tiempo, y disculpame es mi pirmer post y no conozco muy bien el proceso completo... ya use paste bin... este es el link que me arrojo ... pastebin.com/j7k1ymFu
    – FRANCORALF
    Commented el 9 ago. 2019 a las 16:50

1 respuesta 1

2

Para convertir una imagen en hexadecimal a un formato jpg o png debes primero pasar la cadena de hexadecimal a string, luego puedes usar la función imagecreatefromstring() para convertir la cadena en imagen.

Para probar puedes convertir una imagen a cadena hexadecimal con ayuda de una pagina (por ejemplo tomeko.net).

Una vez obtenida la cadena se la coloca en una variable ($data) para que luego sea procesada y muestre la imagen:

<?php 

    $data="FFD8FFE000104A46494600010100000100010000FFDB008400090607101212150F1010161515161515121015121515151515151515161715151715181D2820181A251D151521312125292B2E2E2E171F3338332D37282D2E2B010A0A0A0E0D0E1A10101A2D261F252D2D2D2D2D2D2D2D2D2D2D2D2D2D2B2D2D2B2D2D2D2D2D2D2D2D2D2D2D2D2D2D2B2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2DFFC000110800B7011303012200021101031101FFC4001C0000000701010000000000000000000000000102030405060708FFC4003E1000010302030504070702060300000000010002030411051221063141517122618191071332A1B1C1D1142342526272F082E1162433435392B2E2F1FFC400190100030101010000000000000000000000000102040305FFC40026110002020202010402030100000000000000010211032112314104223251136171819123FFDA000C03010002110311003F0094023B23B2164C41224AB2228188290538520A402E98F6DBD47C5749A33A0E8B9A45BC750BA461E7B2DE89A13263B726DDB93AEDC9976E4C04C7BCA7134CDEAA76C318FB2D33E50466B658EFF98E83CB7F82415664BD226D939AE3494CEB11A4CF1BC7E807E2B014F726E753CC92A049292E25C6E492E713BC9254FA694750B2E46D9AF1C5225450973AC6C41E02EA4C80C6EB0098A5AB0C78B0B72DDF048AAAA7175C82470FECA6B47425996E910D5BE370731C5A41D08FAA8FEB0703F34D19C8D46A388FA284994E8EC9B21B402AA3B3B491BED8E63F305A15C5F00C41D0BD93C7A81BC731C5ABB0D1D4B65636461B8700478AD58A7C953ECC7961C5DAE87904105D8E4041120800D120824004104481810410480229252924A004948296524A004208D1200C0590B2520980929252CA41400929052CA2290090BA26127EED9D173B5BFC0DD7899D108196C77264EE4E94D1DC55086C1D572AF4B18AE7919034E8CBB9DD7F9F05D2B13AB1131F2B8D835A4AE038B5619A59267713A745CA6FC1D20BC9566E5D6BDB8F52AF30FA5CD60012552D336EEBEA755D43657050181EE1A95C6469C71B2AE2C18E5B968BEE3CD574D465BBC69AAEA2DA06DAD942ADC57056904816E8A5D9DF8A397CCD20FF003CD341DAFF0038AB7C6694B090474F92A70DBFC7C0FF0071EF4D2D1C65A65A61EFB1EE26CE1DEBA6EC0D6DDAF809F64E66FED3BFDFF15CB9A6D95DC1DA1EBBFF00BF815ACD85AF2DA86876F378DDF107CC7BD28BE334C99AB8B4752410416D31848208200089044900685D122400A4112090C088A340A004149296524A004208D040180411A0980829252CA49400929052CA494804ADCECEBBEE5AB0EB67B32EFB91D5005FA6B814E04DF3542315E93EB7D5D2E51BE4706F80D4FC171F9B401BE27C3E4BA07A5BA9BCB0C3C034B8F5711F20B9B5793E7A05C27D9A21A897BB258799E4D3D866A4F32BAF51C61AD0D0B25B1784FAA801E2EED15AB86403783D40BAE7D9A62A916313929E014D432B0EAD703CF98EA138EB2651CFF6FE9C35BEB0702B1104809F0B2E87E90E3FF2CF3C87CD725A7A8B387F39A488CBE0D031DD873788ED0EADB1F85FCD59607539668DC3896FC74597A7ACED7536F022C55860D31B8EE2A668889E8785D700F725A8D87BEF1B4F3682A4AD88C6C2448D04C4122468900120820800D0448D48C082089001149296524A004A08208030288A34453012524A594928010524A5949290095AED9677DD78AC8AD4ECA1EC3877A00D3B4A42530A412A8471BF494FBD55FB8FB8E51F0589A96DE560EF68F33AAD7FA4375EA7FA47BCB8FC9672386F3467F537E4B3CBB3541691D8B028FEE9ADE400F72898B49510BDA22607E6BEF363A753BD49C25F9400558D7C0D91BF4E0798509D1A5AD988C571C735F96463A2940BDD963A77D890778E2AFB05C5A478B482FA68E02D7EA39A7460AE7BB33BB85DCD17206E17B5CAB882898D06F6B01F04DEDE849D2D993DB5A963A9646DC5C836DDBD7166C83C6EBAED561CD96425CE02E4FB772DB5F4B00B9F631843D9238322B02E22FBC1B7E20392224E4F05199B5D3AAB8C1E5ED755432BBB67C95B60A3B57F244D68E307B3D25823EF0467F437E0AC1546CBBAF4D11FD215B2D11E919E5D8112082A242410BA4970E6800D04832B79848352CFCC12B403C8D45757C437BC26DD8B423F1852E51FB0B44E44ABDD8D43F9936EC761E6A7F243EC3922D0A494DD2D4B6419986E13855277D0C4A34104C0C094928CA229804524A514928012524A5158EDA3DAA2D71869CEA3473F7EBC9BF5401AA9E6630667B8347371007BD5BEC8E3F49AB3ED315C9D0676827DEB87D45648F377BDCE3FA892A2BF5E0803D6024005C916E77D3CD64B1EDBFA183306CA2470394B6321C41EFE0B81BF1299CD11BA6796B746B4BDC5A0720DBD934D7F149B1A46AF18C4CD4BCCA45AE6C0776BF54548407B09E0E6FC955D1BB4D79FD54C8E4DF6DF95AE5C19A62761A268201EE0AD60B059CD98AC1242C75F5B0BF51BD5E3661B895CCD364A33E6DDC126AA4222773B28B5B17FB8C395C070DC7B88E2A04F8C97372643988DD6D3ADD558526458E903DBAE9BD66B6C1D153C2E0DB191FA379ABAC47151030971DC093C82E6555883AA2674AFD458E40780E1F24A2AC8C92A5467BD56AAF70C6D9A3F9C940643DAFE70561878F647F37AA9BD1C60B677CD9075E999DD71E454AC66BCC4D1977955FB21714ED1DD7F7A2DA877B03AAB949AC568C995D5910E332FE64D9C5A63F8940444AC1F927F665E4C98EC424E2F29A7553CFE23E69825129727F62B6386677329B748524A0A6C618722BA244900B2E4DDD02905C819A9D931D871FD4AF0AA3D933F76EFDCAEC95EA61F8234C7A0208905D06608A494A2925500492529114014FB535C61A77B9A6CE36634F22EE3E57587C37666B2A0668A07169DCE36683D0B8EAB798A5136696063F56073A470E0728B007C5CB5D40400005CA73E3A477C58B92B6714C43652BE119A4A57E5E2E680F03FEA4D95112BD4108598DAFD86A6AB697B5A229ADA48D16B9E4F68F687BD28E5FB1CB07D1C11C5007552B17C365A695D04CDCAE6F911C1CD3C4150C95D0E1D16F4B3683BCFD54A81FDAFE9B2AAA3934B78A9F03BB4D3E6B8C8D30DA361B1389643EA5C74274EE2B7151102DB39B7E4797D1727A79723B370BEBDCB7983ED259B964171C0FD572F2698FDA1EF5D2B0FDDD61006F8E6EDB7CF7D943931D945DD298B4FC4DBB45BA152EBABA0905F25CF0585DAA2E70CA34683736DDD155D97927AE887B4D8E1A876461EC5F53F98F3E8AB607E5D537232DE17F9236FB3E6BA568C2DB6ED936266A4F71FE7BD4AA366A0754DC1C7A7D13D4C75F35CE5D1D22772D9C19628C73691EF2546DA53DB68EE2B3BB2BB73010D82A3EE9CDF65E4F61D7EFF00C27AAB8C66A59238398E0E16D0B4823CC2ACAFFE461CDE48164564115D6032068144814860292502512400444A0524A0005212894948A34DB287B0E1FA95E5D506CC1ECBBAABBBAF530FC11A61D0BBA09BBA35D4A310524A3288AA104925194450034F1DB61FDC3CC5FE4AE286459CC55E5A6178DC25687F47B5CD1EF7355D52BD67CAB66CC0FDA6969E4D13EE7DD54C33296C95723BD194F487B36DAB8496802560262773E6C3DC570E7020904588D083BC11A10BD2F54DB85C3BD21E1260AA3201D897B40F0CC3DA1F03E2576C72F066CF0D7233B4CEB107C15A529ED2AA8B7F8AB2A2049D37EF464270BF05BC71DC7B95FECF5239CCB6FB1201EEE1E0ABB0AA263F57DCEE2003A77E9E056F70CA06B00B2CFD9BD2A457B30F274DC38AA5DA6A4022361C40F35B8737B950ED04799B940DC1CF3E02C3E29F43ABECE695B1D85F9A8B11EC7FDBE0AC2B751D02AF6E8C3FB8FC1768BD1826A996303B78FD253B11D4F8FC54484FCC29111D5DDC0A991D2057544BDA77F3B96F7D1CECF3DEDFB5CA5C1A748981C5A1D6DEE36DE2FB82C07A87492889BBDEF0C6FF005380F9DD7A130BA46C71B2268B358D0D03B80B2737AA231C549B6C892E1E0FB3A155B3445A6CE0B59EA428B554A1C2C42CD2C62CDE9613DC74CCCDD0BA955740E66A351EF0A15D716A8F3270941D49065C85D209414921A089040C05120524A43343B30747F50AF2EA87660E8FF057975E9E0F8234C3E283BA093741752CC694928D24AB24244519492801BA9843DA5A78FB88D41F3B29146FE69A4C7DA5AD9325F52DCC3BC0363F2F35CF22B477C12A745EC72A99148A9A191584122CCCDB658EF59FDABC059570BA276877B1DC5AE1B8ABC8DE94E7042626AF479CAAE924824314ADB398EB3870EA3983BD4FC0ADF686B0EE71C9E60DBDEB77E943000F8BED718ED47EDDB8C677FF00D77F4BAC66CBECF56D593352479FD539B989735BA8ED01AF82EEDA946D98E9C27A35F4D4C627EED3F9FCF15B4A17820744DCDB3B339A0FAB37B6A2E2E0D94BA3C22768178CF7AC8B4CF49CA2D7629C155D6437121FD397F9E615EFD8A5FF008DDE4A2C9432D88F56ED4FE52AD89491C7F178B24859FA6FE5FF00C4BFF0A56FA83502026320386ECD6D75CBBED656B8F601592D5911D3496CC0071638372868CC731D2DBD755A563FD5B630DD0340EED059572A4718E35924DB380C27B37EF23E3F452291DDA3DE3E2BA5D57A3AA6BBDDEB9EC739C5ED0037234924DADBEDA95CBA3EC3CB4FE125B7E762750A9BB473E2E0D5963B2D08388C37DC1C5FE4C247BD76DA5942E1D855408EB633CAE3C0823E9E6BA9E1F5D74A4FA1E35DFF0026B58F44FB155D0CFDEA47AC455961491A835142C76F163CC68A697A250E20D464AA48A19F0B78F64DFAE854192373747023AAD5162664603A6FEAB93C69F4659FA383F8BA33374575773616C3FA7A7D1449309770703D7450F1C8C72F4F35D6CAFBA24E4F0B99ED0B77F0F34D2E6D51C5A6BB2FF667F1F82BD2A87667F1F82BC2BD1C1F046987C43BA093741762CC72228AE82B202288A051140C22B23B7552F85D4F50CDED739A7BC100969EB65AE2B37B774B9E95CEE3190FF0DC7DC501745BE0B89B268DB230E84791E20F7AB78AA2CB8E6CBE3869A4B38FDDB8F6C723F987CD74C8EAC380734DC1D411C9669C68DD8F272469219AEA408EFC553D1D50B056904AB8D1DAC1554D99AE63B56B8169078822CB8FE25B3188D097184C8E8CFE2A773EF6E19D835BF7EA176D6D8A0630AA32712278E33309E8FB1B92780C5248E3244ECAFCC4E72D3AB49BEBCC782D8B2A5DF98F994A929197CD945ED6BD85EDCAE9BF55649B4D9518D24879B54FFCEEF3294CAB9BFE476FE6990DB6FD1353CC46E1709A563697D17783CB25889277486F7ED5858720005326AA6B47D37ACAD14D2BCF60651C5C741E038ABEA67340D4DDC3793F255542A18A9A6924D4F6070E2E3F45CB76B71FA8A5AA7537DD48D0D6B9A5F182E00F03AD975B92A0BB468B9F70EAB94E2DB2B34F8A649DD76BBEF4BDB71F760E8CEE37D3C547E1849FB959193249474334D5B5756CCB0D1D39B5AEEC818FD1C0DDAEBEAB69B1F814B3485AF20319A39CDDEE3F9403B938DA56C42CC680D6FB206961B8FD7C16B761E9C084BEDABDCE3E17B0F82E91C49349193F234DB5E4B28F67E9C0B069EB98DD41C630B7346761BB40032F10071EF5A3BA838954860B1D491BB9AED24A821393968C8871E48F314B68C83B46E547A79C3DF93B89D39859673E2AD9AF2496356C9940C0F758BAC389DFE0AC22A469363A0E7654B87D480F2D2D69D77827E455EFAF16F6079BBEABCF94A3293B974FF7FE1E3E6CAE536ECA8AD680743FDD427CAA6573838869C8C1F9ADBBC545C418D696E516BB6EBAFA7CCB51BB357A5CFA507D919E41163A83C154D553E53A6EF87729CE2A0554FC0EE5A67152468CD894D7ECB7D99DEFF057C42CF6CB3B57F40B425CBBE0F823243E225047741762CC55D0BA604851E63CD559343A52520B8F349CE51614384AABDA63FE566BFF00C6EF829C643DCA1E2B119627C5BB3B4B6FCAFC6C8B414CE4255D6CFE3CE80E475CC7CB8B7BC77772B13B12FE1379B3FF006493B0F3F095BE2D23E6A5D32E3C93B46EB01A86C87437045C7257D09B1B2C06CDE0D5B4CEF698E6F2BB85BA68B671544BF8A23FD26EB3CA3BD1AE33B5B2E593290C9D5055626D8DA0C9766A00CDCC9B59390E24DE06E9515C8BB7C89A748A136B014465450EC7E69411629CC381CB7BF1235E4AB9E6FB9312CB234581D0EFFEC9AD1499672D6E53A5CF404FC15851B4121D2E80F0E3E2ABB380CD0F7A8C6AE77F61ACDFB89D00EF54234EFA86B4E46F1D1A071519F485B239EFB6620374E00126DEF4ED0411C2CF58E707388D5C7E5C9731DACDB773EA9ADA7790C8C90E2D240793BFA8164E2B672CCD71A3A24F1820F8AD86094DEAE163393405C66936989B137E077AEB5B375B2CF13652006B9B99A0EFDF6D5765D98DA2DE492DC3A2CD6D1CE62BCAE6920803405C41E4005A17CCE1ED374E635599C4F1107B648B701C9464E8EFE99372B454C70CB2769E32377EBED79704D19638E58F503523529B931273C9118BF7FE11F5591DB6C4238446C73EEF24B8F3B01CB96AB34F1F38B477CEB945A3514128F5AF00DC071DDD56AA33A2E3DB3BB52D6C81991CECEE681616D4E9C782DECFB52227B607C2FCEEB6502C46BA0D6EBC99E19E39B54789920E32A26E2BA02543C4EB5872E570366EB6E0ABF69F18963FBBF556739B7049040BF3B2C5BCD5BFDA988FDA00F8DD68F47E9DBF7BFE8D1E971ED4D9B074E0EF2ABEAAB2271CA1C096EFB1BACF370C2EF6DEF77571B795ECA4C386B19EC803A2F45C2D1B6726E2D1ADD9DAF8DAE7663BC69A15A035ECE7EE2B0D446CE0AF04BDCBA628F18D1961A545DFDBD9CCF920A8CCA505D0A39FC10551D0324F10EB799561161B5E78B9A399737EAA33FD22CC4110D0000DF573CBADE19542936B7147B72B638D8DD773493ADEFBCFBAC9D08D34784D68D1D30037EA6E7C8B7E6AC21C0EA2FDAA8E4748DBC6FC751C0AE7F535B8A3DD792A6C6DF81AD6D8750113B09A993FD6AC95DCEEF711EF28A4074834B1463EF6A583F7B98DFA285518B61ACF6EB19FD2E07E1758566CC43F89CE7752A43305A56FFB60F5468A5668A5DB2C299B9CF93F6B1DF3B28CFF004814FF00ED514AFE57007D5408A9E11ECC6D1E0A4B72F0684AD15C5B09DB7358EFF4A81ADFDCE27E0028D26D062EFDC228FA36FF00F95D4D694B4B994B199BC462C425169EA0B87201A0790010A6A7AA60B3652168E44D80A5CACA50A2BE0ABAE6EE91A7AB7FBAB0871BAD1ED32377891F54642165365A4C71DB433F188783AFF1093FE2B93F1404F42134E6A6658D1A2AD96116D731841F56F6B6E33348B8EA2C568EAB68630D1236561691A59C173E9694B9373E02CDF6D53A44F2916FB47B56E730C71487B5BC34DECDE3D0AC8C2DD55BC58500D20051DB4C5A5354739DBEC95484AE93827A4510451C52C640634333375040E25BF45CFA95AB578460EC91A0B85FAAA47375E4DBB3D2761E5A2F28BBBB2D02F7BDBF103EC8EF592AAC62999774B366BDDC05EFBCDEC1A1588D9E82D63183CB4599ADC2B2B8D87144F675C32ABA22E23B727D8A684DBF33FB3E415198DD50F32CBAB8FC390570684724F53D201C141536FC95B1C4D8882D1A820B7A8DCAE2BB119E495B2BC37300DC9941005B5D6E75D5265A4D468ACE2A6040BF259723F727462C93F72646C46BE4964CD3653A00DC8080071DE4A364613B55023632DAAAC0EA29158727B6847AB0121E14829A72D474948445BD5B35DA2A961564C76813473439741273A0A8A310CB004008EFD9B2241020DE6E52F3A082060CC90F410498E21C414A635041433BA1C604B282090C438A6F32082401E6401468245808492C468210019127B25D0415087D908B2ABC420010410852E86E918B73803BB211A0BA23332F8BF454B5F08D50410C707B2A1F0046C89120A68B931C923D54A89A2C820B8CD18E4226626EC2C8209C10E234E29972341763A88532276810413424397082082A19FFD9";

function hexToStr($hex, $string=''){
    for ($i=0; $i < strlen($hex)-1; $i+=2)
        $string .= chr(hexdec($hex[$i].$hex[$i+1]));
    return $string;
}

$im = imagecreatefromstring(hexToStr($data));
if ($im !== false) {
    header('Content-Type: image/png');
    imagepng($im);
    imagedestroy($im);
}
else {
    echo 'Ocurrió un error.';
}
?>

En la linea header('Content-Type: image/png'); se selecciona el formato de salida.

Como resultado de este ejemplo debería mostrarse la siguiente imagen:

introducir la descripción de la imagen aquí

Probando con la cadena de la pregunta se obtiene lo siguiente:

introducir la descripción de la imagen aquí

Espero sea de utilidad, saludos.

3
  • 1
    Muchas gracias, por el ejemplo, funciona.... la duda que me surgió, es que ahora no se si la cadena que tengo es hexadecimal, porque yo la veo muy diferente a la que me arroja tomeko.net, se supone que esa foto es la de un zapato.
    – FRANCORALF
    Commented el 9 ago. 2019 a las 17:37
  • @FRANCORALF habría que verificar si es que la imagen se cargo correctamente o si el formato no era hexadecimal sino otro formato (que no creo por que en ese caso no retornaría nada), igual avisa cualquier duda. Commented el 9 ago. 2019 a las 17:41
  • voy a confirmar lo del formato y apenas tenga la noticia subiré el comentario, muchas gracias a todos por la ayuda......
    – FRANCORALF
    Commented el 9 ago. 2019 a las 17:48

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.