Well, it may not be just the photos and music occupying space on your iPhone. At times, the installed apps and the temporary data files, cached data also leads to 'out of storage' messages.
In order to stop out of storage messages on iPhone and iPad with iCloud Photo Library, do the following:
Automate backup & migration of your photos & videos with support for all top services.
Trusted by users in 125+ countries.
“Your pictures are scattered. PicBackMan helps you bring order to your digital memories.”