When ads make in into gallery - what you're seeing is probably cached images from one of those apps. Apps that aren't very well written won't add a ".nomedia" file to the directory where those images are cached--".nomedia" instructs the system to ignore that directory when looking for photos to add to the Gallery database. This kind of thing is fairly common, even among legitimate apps--it's generally not malware, and isn't necessarily adware either.
samsung s4 phone overheat solution
To reset the cache: Turn off phone Remove the battery and reinsert. Hold down the Home and Volume Up keys Press and hold the Power button while still holding the other keys. As soon as you see the Samsung logo, release all keys/buttons. Press on the Volume Down to scroll down to Wipe Cache Partition. Press the Power button to select it. Press the Volume down button to highlight "Yes" and press the Power Button to select it. Wait for a few minutes for the phone to clear the data. Then press the Power button to select reboot system now. Wait for your phone to reboot.