You should probably hook into the cycle-after
event to set the width.. Something similar to this:
$('.cycle-slideshow').on('cycle-after', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
$('.overlay', this).css({'width':$('img',incomingSlideEl).css('width'), 'height': $('img',incomingSlideEl).css('height')});
});
$('.cycle-slide').hover(function () {
$('.overlay', this).show();
}, function() {
$('.overlay', this).fadeOut();
});
The only thing you may have to do is set the width and height of the first overlay outside the event because I don't think it is fired on the first slide.