If your geometry is not a mesh, i.e. you have a basic geometry in your visual tag (box, sphere, cylinder), this should work:
Create a material file example.material
(your_package/media/materials/scripts/example.material)
material YourMaterialName{
technique
{
pass
{
texture_unit
{
texture your_material_image.jpg
scale 1 1
}
}
}
}
This file can have multiple materials, not just this one. Then, outside the <link>
tag of your URDF:
<gazebo reference="your_link">
<material>YourMaterialName</material>
</gazebo>
However, if your geometry is a mesh, in addition you will need to prepare your mesh to receive the image. Open your mesh using Blender, then first imagine how would you cut your solid with a scissor in order to put all surfaces in a plane. Then, select those edges, press Ctrl+E and select Mark Seam. The edges will become red. Split the window into 2 and in the new window choose UV/Image Editor as the Editor Type (bottom left corner). Then, press A to select everything, press U and choose Unwrap. At the UV/Image Editor will appear a geometry showing all your object faces in a plane. Now you can export to COLLADA (.dae) and put in your visual geometry mesh.
If you could not follow up the Blender steps, take a look at this tutorial: https://youtu.be/f2-FfB9kRmE