Discussion:
[ gaim-Patches-1662169 ] Log Embeded Images
SourceForge.net
2007-03-21 00:53:40 UTC
Permalink
Patches item #1662169, was opened at 2007-02-17 03:26
Message generated for change (Comment added) made by rlaager
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=300235&aid=1662169&group_id=235

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: David Grohmann (dave1g)
Assigned to: Richard Laager (rlaager)
Summary: Log Embeded Images

Initial Comment:
This might be aim specific, I'm not sure if the other protocols can do this. But in aim, you can send an image embedded in an IM. But in the logs it just comes out to be something like

(2:48:05 AM) Dave1g: <IMG ID="1">
(2:48:14 AM) Dave1g: <IMG ID="2">

Deadaim used to log the sent images so I know its technically feasible.

Create a folder in that log directory with the name date_images and src the images from there so when the html log is loaded in a web browser the images show up.


Perhaps this could be a summer of code 2007 project? There seems to be a lot of feature requests for how logging is done.

Thank you.

----------------------------------------------------------------------
Comment By: Richard Laager (rlaager)
Date: 2007-03-20 19:53

Message:
Logged In: YES
user_id=156487
Originator: NO

I think you're on the right track. I do have some comments.

image_file_ptr = fopen(path, "w");

You're writing binary data, not text. Change the "w" to "wb" instead.

Regarding this...
fwrite(image_data, 1, image_byte_count, image_file_ptr);

To me, you're writing 1 image of a given size, not a number of 1 byte
blocks ;) I'd change this to, which should still work:
fwrite(image_data, image_byte_count, 1, image_file_ptr);

Please indent your code, and if variables are only used within a given
block, please move the variable definitions there instead. For example:
+if (imgid != 0)
+{
+gaim_imgstore_ref(imgid);
+image = gaim_imgstore_get(imgid);
+image_data = gaim_imgstore_get_data(image);
+image_byte_count = gaim_imgstore_get_size(image);
+original_filename = gaim_imgstore_get_filename(image);
...

You should be able to move the variable definitions to there instead of
doing them at the top.

I'm not sure how much I like the idea of saving images with the date and
original filename. I think maybe we should be saving them with a file hash
instead. That way, if the same image is embedded multiple times or used
across multiple conversations, we would only save one copy. This is
important for MSN custom emoticons, for example. You should address the
other concerns first, and then I can offer some guidance on making this
change.

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:53

Message:
Logged In: YES
user_id=1055565
Originator: YES

Well I have the patch almost working. The output file is slightly
corrupted from the original. I cant figure out why that is happening.
Perhaps another pair of eyes can point out the flaw.

I compiled and tested this with svn from a couple days ago and on a cygwin
windows xp installation. core 2 duo dell laptop.

Please if anyone else is interested in this, take a look at my patch and
try to fix it.

P.S. the formatting isnt up to snuff, but it doesn't work so I wasn't
worried about getting it committed yet.

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:46

Message:
Logged In: YES
user_id=1055565
Originator: YES

File Added: 2007-03-18.040726Central Daylight TimeCDT.html

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:45

Message:
Logged In: YES
user_id=1055565
Originator: YES

File Added: 2007-03-18.040726_handdrawn copy.jpg

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:44

Message:
Logged In: YES
user_id=1055565
Originator: YES

File Added: handdrawn copy.jpg

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:42

Message:
Logged In: YES
user_id=1055565
Originator: YES

File Added: image_logging.patch

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-16 00:50

Message:
Logged In: YES
user_id=1055565
Originator: YES

well i got bored today, and am attempting to put my time where my mouth is
and write a patch that logs images in aim

----------------------------------------------------------------------

Comment By: CWAL (cwal)
Date: 2007-02-18 10:54

Message:
Logged In: YES
user_id=1410499
Originator: NO

I would find this feature useful as well.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=300235&aid=1662169&group_id=235

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
SourceForge.net
2007-03-21 07:58:54 UTC
Permalink
Patches item #1662169, was opened at 2007-02-17 03:26
Message generated for change (Comment added) made by dave1g
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=300235&aid=1662169&group_id=235

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: David Grohmann (dave1g)
Assigned to: Richard Laager (rlaager)
Summary: Log Embeded Images

Initial Comment:
This might be aim specific, I'm not sure if the other protocols can do this. But in aim, you can send an image embedded in an IM. But in the logs it just comes out to be something like

(2:48:05 AM) Dave1g: <IMG ID="1">
(2:48:14 AM) Dave1g: <IMG ID="2">

Deadaim used to log the sent images so I know its technically feasible.

Create a folder in that log directory with the name date_images and src the images from there so when the html log is loaded in a web browser the images show up.


Perhaps this could be a summer of code 2007 project? There seems to be a lot of feature requests for how logging is done.

Thank you.

----------------------------------------------------------------------
Post by SourceForge.net
Comment By: David Grohmann (dave1g)
Date: 2007-03-21 02:58

Message:
Logged In: YES
user_id=1055565
Originator: YES

Thanks for the hint Richard! I will attempt to address your concerns. I
must admit that most of my experience is with aim. And so I may need the
input/help of others to make this patch useful to other protocols. It is
not my intention to log smiley faces I wasn't aware of the custom ones you
speak of on other protocols.

So as far as naming conventions go I was just going for something that was
simple and had little chance of writing over another file. Wont have any
time to work on this soon, but maybe this weekend.

Glad you took notice of my work :-)


----------------------------------------------------------------------

Comment By: Richard Laager (rlaager)
Date: 2007-03-20 19:53

Message:
Logged In: YES
user_id=156487
Originator: NO

I think you're on the right track. I do have some comments.

image_file_ptr = fopen(path, "w");

You're writing binary data, not text. Change the "w" to "wb" instead.

Regarding this...
fwrite(image_data, 1, image_byte_count, image_file_ptr);

To me, you're writing 1 image of a given size, not a number of 1 byte
blocks ;) I'd change this to, which should still work:
fwrite(image_data, image_byte_count, 1, image_file_ptr);

Please indent your code, and if variables are only used within a given
block, please move the variable definitions there instead. For example:
+if (imgid != 0)
+{
+gaim_imgstore_ref(imgid);
+image = gaim_imgstore_get(imgid);
+image_data = gaim_imgstore_get_data(image);
+image_byte_count = gaim_imgstore_get_size(image);
+original_filename = gaim_imgstore_get_filename(image);
...

You should be able to move the variable definitions to there instead of
doing them at the top.

I'm not sure how much I like the idea of saving images with the date and
original filename. I think maybe we should be saving them with a file hash
instead. That way, if the same image is embedded multiple times or used
across multiple conversations, we would only save one copy. This is
important for MSN custom emoticons, for example. You should address the
other concerns first, and then I can offer some guidance on making this
change.

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:53

Message:
Logged In: YES
user_id=1055565
Originator: YES

Well I have the patch almost working. The output file is slightly
corrupted from the original. I cant figure out why that is happening.
Perhaps another pair of eyes can point out the flaw.

I compiled and tested this with svn from a couple days ago and on a cygwin
windows xp installation. core 2 duo dell laptop.

Please if anyone else is interested in this, take a look at my patch and
try to fix it.

P.S. the formatting isnt up to snuff, but it doesn't work so I wasn't
worried about getting it committed yet.

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:46

Message:
Logged In: YES
user_id=1055565
Originator: YES

File Added: 2007-03-18.040726Central Daylight TimeCDT.html

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:45

Message:
Logged In: YES
user_id=1055565
Originator: YES

File Added: 2007-03-18.040726_handdrawn copy.jpg

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:44

Message:
Logged In: YES
user_id=1055565
Originator: YES

File Added: handdrawn copy.jpg

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-18 05:42

Message:
Logged In: YES
user_id=1055565
Originator: YES

File Added: image_logging.patch

----------------------------------------------------------------------

Comment By: David Grohmann (dave1g)
Date: 2007-03-16 00:50

Message:
Logged In: YES
user_id=1055565
Originator: YES

well i got bored today, and am attempting to put my time where my mouth is
and write a patch that logs images in aim

----------------------------------------------------------------------

Comment By: CWAL (cwal)
Date: 2007-02-18 10:54

Message:
Logged In: YES
user_id=1410499
Originator: NO

I would find this feature useful as well.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=300235&aid=1662169&group_id=235

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Loading...