How can i achieve image like this ? when source is vertical :  when source is horizontal : 
How can i achieve image like this ?


when source is vertical :
when source is horizontal :