[ZBX-417] Image upload not working properly Created: 2008 Aug 08 Updated: 2017 May 30 Resolved: 2014 Apr 08 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F) |
Affects Version/s: | 1.4.5 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Major |
Reporter: | Steve Ruiz | Assignee: | Unassigned |
Resolution: | Cannot Reproduce | Votes: | 5 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Centos 4.5, zabbix 1.4.6, postgres 8.2.x |
Attachments: |
![]() ![]() ![]() ![]() |
Description |
When trying to create a new image (icon for map), I get the following error when trying to display the image (i.e. it uploads ok, but does not display properly): (main text of the image, html not included) To reproduce: |
Comments |
Comment by Steve Ruiz [ 2008 Aug 08 ] |
This is what I see in place of the image I uploaded. |
Comment by Steve Ruiz [ 2008 Aug 08 ] |
Was able to get around this by changing line 124 in images.inc.php: return DBexecute("insert into images (imageid,name,imagetyp e,image)". " values ($imageid,".zbx_dbstr($name).",".$i magetype.",'".$image."')"); Removed the zbx_dbstr($image) and replaced with just $image, since we already escaped it with pg_escape_bytea() function. |
Comment by Julien Poumailloux [ 2009 Jul 29 ] |
I was able to fix the issue, the previous code given by Steve Ruiz is buggy. in function add_image from include/images.inc.php, replace: else if($DB['TYPE'] == "POSTGRESQL") { $image = pg_escape_bytea($image); }by the point is that postgresql expect the $image part of the request to be between quotes ', while this is not required by mysql. Sincerely, Julien Poummailloux |
Comment by Aron Ujvari [ 2009 Sep 21 ] |
I would recommend the attached patch against Zabbix 1.6.6, but the same modification should work with oldaer version also. This is an ugly hack required for PHP's PostgreSQL interface since pg_escape_bytea and pg_unescape_bytea are not inverse functions, so we are not able to get back the same binary information from the database as we loaded before without this patch. It also contains a fix for update_image function, as we it needs zbs_dbstr($image) but not the extra quotes to allow updates. add_image function works the same way by default, this patch changes the update_image function to this way too. |
Comment by Andrew Flannery [ 2010 Nov 04 ] |
here's my 1.8.2 patch for the same issue with mysql. |
Comment by gabhosh [ 2011 Aug 09 ] |
Here is mine for 1.8.5 for the same mysql issue |
Comment by richlv [ 2011 Aug 21 ] |
|
Comment by Jc Duss [ 2011 Nov 23 ] |
I've got the same troubles here with a mysql 5.1.49 and apache2.2.16 my table images and database zabbix are set with utf8 charset. I tried the patch for 1.8.5 here without success. If I "tcpdump" the traffic, I can see that image is uploaded... but store in database is not done. The blob field in the tables remains empty. I tried with both PNG and JPG without success. Can someone help me? What kind of information can I give you? Nicolas |
Comment by richlv [ 2014 Jan 14 ] |
this should be fixed by now - is anybody seeing this with recent zabbix version and proper utf8 db ? |
Comment by Ivo Kurzemnieks [ 2014 Apr 08 ] |
Issue has been fixed in latest Zabbix versions and is no longer reproducible. CLOSED. |