Change gallery to use the OCP functions instead of the core ones

Used the script https://gist.github.com/bartv2/6038598 to do the conversion

@eMerzh @schiesbn @Raydiation @Kondou-ger