generate image based on id

generate image based on id

trf000trf000 Posts: 4Questions: 2Answers: 0
edited March 2015 in Free community support

I need to generate an image based on the record user_id. However, not all users have an image, and I need to then display a default "Image Not Found" image in its place.

This is the code used to generate the image, and make the name a link to a view page:

"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$('td:eq(0)', nRow).html('<img width="100px" src="https://my.photos.com/photos/' + aData[0] + '.jpg"><a href="view.php?user_id=' + aData[0] + '">' + aData[1] + '</a>');
return nRow;
},

any help is appreciated.

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Can you do a check for aData[0] === null or similar. If so, that would be the way to do it.

    Allan

This discussion has been closed.