If you just need to store and retrieve the IPFS hash of an image you can simply use Solidity's events. It may be a bit more complicated but it is a lot cheaper to deploy and use the contract.
Here is a basic approach:
event Store(string indexed id, string ipfsHash); //declare event
function setEvent(string memory _id, string memory _ipfsHash)public{
emit Store(_id, _ipfsHash);
}
When you emit the event in your smart contract, the parameters passed to it are stored in the transaction's logs, a special data structure of the blockchain.
Note that logs and their event data are not accessible within smart contracts. However, you can use libraries such as web3.js inside you app to retrieve them. The use of indexed keyword before the id parameter let's you effectively search for a particular log, containing a desired value. Without it, you would have to retrieve all logs produced by a particular event and search through them manually.
There are a few ways to retrieve past logs, but i will paste an example using getPastEvents :
var contract = new web3.eth.Contract(ABI_of_contract, address_of_contract);
contract.getPastEvents('Store', {
filter : { id : '...id corresponding to the ipfsHash'},
fromBlock : 0,
toBlock: 'latest'},
function(error, result){
console.log(result)
});