@acrylian: echo `<ahreff='".getAlbumLinkURL().$firstimage.".php"'>Next</ae>` didnt work. i had to change $firstimage to $firstimage[0]. That did the trick

thanks.
@gerben: thanks for looking in to it, i decided to use acrylian's method because i will forget that i changed the functions file and with an update i will get lost

This way it is easy for me to change if necessary.