You do not need to use triggers for this if you control inserts:
CREATE SEQUENCE seq;
CREATE TABLE mycount
(
line NUMBER(10,0)
);
Then, to insert the value:
INSERT INTO mycount(line) VALUES (seq.nextval);
For images, you can use a BLOB to store any binary data, or a BFILE to manage more or less like a BLOB, but the data is stored in a file system, such as a file jpg.
Literature: