Broken photo for id like "zcrm_12345"

Hi

I migrated my some contacts from another crm so I decide use their id for contact id in suitecrm
Also I migrated my image for contacts avatar prepared there for suitecrm image stored like idContact_photo, and move those to /upload. Sure I updated MySQL like
update contactssetphoto='zcrm_3111820000006915042_photo' where id = 'zcrm_3111820000006915042';
But my photo not appear
image
image

But it works well if I try to check with the default contact id like “102bcdff-de19-685f-42f0-5f04449bab52”
I created-moved 102bcdff-de19-685f-42f0-5f04449bab52_photo

Of course I checked and gave permissions and delegated to user-group

I think the problem is at the beginning of the identifier, the standard ones start with numbers and mine with letters “zcrm”

My suitecrm version is 7.11.15
PhP 7.4
ubuntu 20.04

please, any your advice on how I can fix this, change the code so that the system checks the id with beginning letters

I hope you have seen this

The filename as it appears on screen is not the same thing as the file name expected on disk. That one is always formed from the Bean id.

@pgr thanks for reply

Yes, I’ve read your blog thanks there are many useful things

as I understood from the blog and from my test uploads of images and changes their names in Mysql fields.
image
for first column it’s not working too
Data in the fields have can be any name if photo ID is of the correct format contactID_photo then the photo will always appear
or it’s wrong?

What is the name of the files that you want to be found for those two photos?

@pgr

zcrm_3111820000009531260_photo
zcrm_3111820000006915042_photo

I have correct name for all files…
image

That doesn’t match. The filenames need to be exactly the Bean id, with photo afterwards.

In your database, you can change the bean ids to be in that format zcrm_3111820000009531260 if you really want to. They don’t have to have that UUID form like 102bcdff-de19-685f-42f0-5f04449bab52.

BUT if you do that, you need to make sure you update all relationship tables where those records are involved. This will be simple if you have just created these new records, and could be very complicated if the records have been in your database for a while, with users working on them doing different things.

It is probably easier to change the filenames to use the bean ID’s.

@pgr
Thanks for trying help me

But right now I do this
I have contact who has id zcrm_3111820000009531260 and I move in /upload folder my image named zcrm_3111820000009531260_photo (no extension) and this contact not displayed photo in detail view

Also I tested that - create new contact who has default suitecrm ID like “32e32e-dsfd23232-32312-323”
and move image in /upload named "32e32e-dsfd23232-32312-323_photo"
so this contact available to display photo in detail view

what do you think of it?

I don’t think you’re understanding, the value of the photo field is irrelevant:

image

That is only used to display to the user in the Edit view.

The value of the id field is what matters.

So there are two ways to match things:

  1. Change the id field in database to match your file name (and deal with the relationships)

  2. Change the file name to match the id in the database

@pgr
I understood you well

All my photo files have already changed names and all my contacts ID have changed too and have the same ID
Please see the screen from Mysql. It’s table contacts

And here my photo files on Linux server-side
image

p/s it’s not permission issue. I grant all file and folder www-data:www-data and 777

Ah ok, sorry.

Do you get any error in log when it doesn’t find the photo?

Fri Jul 24 15:31:16 2020 [57631][1][FATAL] Mysqli_query failed.
Fri Jul 24 15:31:16 2020 [57631][1][FATAL]  Query Failed: SELECT 3111820000009531260_photo FROM contacts WHERE contacts.id= 'zcrm': MySQL error 1054: Unknown column '3111820000009531260_photo' in 'field list'

@pgr
I just looked now and it looks like a very strange query. I mean contacts.id= ‘zcrm’
Do you have any ideas?

Very strange indeed, if it doesn’t have the column name there. Do you have any previous errors (even if they are smaller, non fatal) a few lines above that, that might indicate where the code went wrong?

@pgr
I switched log level to Warn and didn’t find anything

Fri Jul 24 15:41:41 2020 [58531][-none-][WARN] Configuration variable date.timezone is not set, guessed timezone UTC. Please set date.timezone="UTC" in php.ini!
Fri Jul 24 15:41:41 2020 [58531][1][FATAL] Mysqli_query failed.
Fri Jul 24 15:41:41 2020 [58531][1][FATAL]  Query Failed: SELECT 3111820000009531260_photo FROM contacts WHERE contacts.id= 'zcrm': MySQL error 1054: Unknown column '3111820000009531260_photo' in 'field list'
Fri Jul 24 15:41:41 2020 [58128][-none-][WARN] Configuration variable date.timezone is not set, guessed timezone UTC. Please set date.timezone="UTC" in php.ini!
Fri Jul 24 15:41:41 2020 [58128][1][DEPRECATED] Array

p/s
could php query cut off all the part that comes after underscore ? Look like could

What URL do you see in the Broken Link? Do you see any error in console?

@cherub-chum
there are no one URL displayed when I move mouse cursor on broken image
Please see my messages above there are error in suitecrm.log

This is soooo strange. It should be SELECT id FROM..., instead it seems to be using the value in place of the column name. Are you sure you didn’t mess up your vardefs somewhere, or when trying to change things from Studio?

@pgr
no, I’m not changed anything in my vardefs…
But how it works well if I try to test photo with contact who has default ID like "52a52ce9-04fe-9b28-2307-5f1997426e24"
In my opinion, if it works wrong then it wrong to all contacts all photo in contact
I don’t know

upd:
I created new fields for image named avatar and tested.

Sat Jul 25 06:57:51 2020 [72250][1][FATAL] Mysqli_query failed.
Sat Jul 25 06:57:51 2020 [72250][1][FATAL]  Query Failed: SELECT 3111820000009782007_avatar_c FROM contacts LEFT JOIN contacts_cstm cstm ON cstm.id_c = contacts.id WHERE contacts.id= 'zcrm': MySQL error 1054: Unknown column '3111820000009782007_avatar_c' in 'field list'

So I can’t added photo via suitecrm interface and I can’t directly added photo via MySql

@pgr
I’ve tested on my other suitecrm on other linux server it nothing works
So if someone people can repeat my steps by step

  1. Create new contacts with ID like “zcrm_3111820000009782007” or change one to it
  2. Try to upload image via suitecrm interface or direct move one to /upload , /MySQL
  3. Make sure that contact has ID “zcrm_3111820000009782007” and his image file named “zcrm_3111820000009782007_photo”

Then we can decide that is bug and report her?
upd: I repeat this works well for contacts whose ID like5 "2a52ce9-04fe-9b28-2307-5f1997426e24"

Ok, so I was trying to reproduce your steps but they aren’t clear to me.

Why do you mention an Account in step 1 and then a Contact in step 3?

Which fields did you add to the views (which type, exactly)?

Have you tried calling the file
zcrm_3111820000009782007_photo_c instead of just
zcrm_3111820000009782007_photo?

If the photo field is a custom field, it will have that name.

@pgr
sorry I made a mistake in step 1 . Create new contact that is correct
In contact I already have default photo field.
image

Please can you create new contact and change his ID to zcrm_3111820000009782007
And try to upload photo via suitecrm. I think that enough to see the result

p/s I no need place zcrm_3111820000009782007_photo_c because it’s not custom fields in my case