How to create a shape from which an image is extending out like shown in the attached image

I don’t know how to form this question but I want an image to be in a shape yet I want some parts of it to be out of the shape like in the attached image. I’ve used the mask option but this totally makes the shape transparent and the strokes are not visible.
image 1