All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
This depends on the person's intention. Riyaa' (ostentation and showing off in order to impress others and win their praise) is an act of the heart and not an act of the body parts. When the heart harbors such feelings, they are often reflected in one's actions, but the actions are not necessarily a reflection of the feelings in the heart, even if they resembled the actions of those who commit Riyaa'. There is no doubt that only Allah knows the matters of the heart; Allah, The Exalted, says (what means): {He knows that which deceives the eyes and what the breasts conceal.} [Quran 40:19]
Usaamah, may Allah be pleased with him, said about the man whom he had killed despite him professing faith:
"The Messenger of Allah, sallallahu ‘alayhi wa sallam, said, 'He professed that, 'There is no deity worthy of worship but Allah,' and still you killed him?' I said, 'O Messenger of Allah, he only said it out of fear of the weapon.' He, sallallahu ‘alayhi wa sallam, angrily exclaimed, 'Did you tear his heart open to find out if he said it from his heart or not?' He, sallallahu ‘alayhi wa sallam, went on repeating it to me till I wished I had only embraced Islam that day." [Muslim]
When the person takes photos of his library or the library of another and posts them online, this does not necessarily mean that he did it out of Riyaa' to impress others in order to win their praise or to show off. Rather, it is possible that he did not find another nice picture to post and he liked the look of books lined up on shelves whether in his library or other than it, so he liked to post it as a nice facade without the thought of showing off crossing his mind at all. It is also possible that he intended to guide people to certain books such as a new edition of a particular book or the like. In fact, he earns rewards for doing that; verily, whoever guides others to perform a righteous deed earns equal rewards to the one performing it.
It is also possible that his action was done merely out of his love for books. In this case, his action is lawful; it is similar to a person posting the photo of his beloved children and the like of possible motives and reasons without any trace of Riyaa'. Still, it is possible that it is done to impress others and show off, in which case it is an act of Riyaa'. The Prophet, sallallahu ‘alayhi wa sallam, said, "The reward of deeds depends on the intentions, and for each person is what he intended, so whoever emigrated for worldly benefits or for a woman to marry, his emigration is for that for which he emigrated."
In any case, we are enjoined to think well of the believers in general, and of the people of knowledge in particular. We are enjoined to interpret their actions in the best possible manner and find excuses for them whenever possible. It is impermissible to make prejudgments and form negative opinions about people without any evidence or proof.
Allah knows best.