How to get an image url from media library

You have to convert attachment variable to JSON object using toJSON() . Then you can its property.

use

attachment = frame.state().get('selection').first().toJSON();

instead of

attachment = frame.state().get('selection').first();

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)