Ecard module

dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Tue, 2006-04-04 12:28

I've modified this module (the 2.1 version) to include a link to the image in the HTML email. The user can click the image, and be taken directly to your Gallery page. Here are the changes:

Quote:
Open modules/ecard/templates/Message.html.
Find:
<img src="%image%" border="0" style="padding: 2em 0;" />

Change to:
<a href="%link%"><img src="%image%" border="0" style="padding: 2em 0;" /></a>

Open modules/ecard/classes/EcardHelper.class.
Find:
"text", "header", "footer", "image") as $key) {

Change to:
"text", "header", "footer", "image", "link") as $key) {

Open modules/ecard/SendEcard.inc.
Find:
var $_toName;

After, add:
var $_link;

Find:
/* Get pseudo filename and attach image */
list ($ret, $filename) = GalleryUtilities::getPseudoFileName($item);
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
After, add:
$urlGenerator = $gallery->getUrlGenerator();
$link = $urlGenerator->generateUrl(array('view' => 'core.ShowItem', 'itemId' => $itemId), array('forceFullUrl' => true));

Find:
'image' => $filename,
After, add:
'link' => $link,

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Tue, 2006-04-04 17:40

Hmm... I think in some older version I had included such a hack, however I used the item itself to generate the link. This would not require to pass yet another reference ($link) to the smarty template...

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Tue, 2006-04-04 18:52

I read about this in a prior version as well, but since it wasn't in the current version, I added it :)
I'm also tweaking the template so that if you're currently logged in, it will use your username/email address by default, instead of being blank.

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Tue, 2006-04-04 18:55

oh, and i also snagged the ecard gif from g1 and added it into the iconpack (yeah, i know paul didn't create it, but it had to go there)..so now, instead of a square bullet, the user sees a nice little picture w/ and envelope (see http://www.themolavis.com for the change).

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Tue, 2006-04-04 23:02

Nice, dmolavi! Can I add these patches to the "official" version?
(There are some nice new ideas floating around, like BCC support and multiple recipients, unfortunately I don't really have time for this until May)

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-04-05 11:22

sure thing. i was going to work on multiple recipients today (hopefully). if i get anything working, i'll letcha know.

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-04-05 11:57

oh, btw, if you want the icon to show up, you need to make this addition to modules/icons/iconpacks/paularmstrongdesigns/icons.css:

Quote:
.gbLink-ecard_SendEcard,
.gbLink-ecard_AdminEcard {
background: url(ecard.gif) left center no-repeat;
}

i added this into the "commerce" section of the css file.

 
msulliva

Joined: 2005-09-12
Posts: 3
Posted: Mon, 2006-04-10 18:45

How can I place the Send eCard link on the photo page and not on the images in the album? Assistance would be greatly appreciated.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-04-10 19:50

modify function getItemLinks in module.inc so it only returns the link if $wantsDetailedLinks is set.. see modules/slideshow/module.inc for an example.

 
mohpa

Joined: 2005-09-16
Posts: 6
Posted: Thu, 2006-04-13 22:10

Many thanks for this great module. Been using it since version .7.
Now that I have updated to gallery 2.1, and eCard 0.8, i get te following error when trying to submit the eCard (Preview does work):

Quote:
Error Detail -
Error (ERROR_BAD_PARAMETER) : Controller results are missing status, error, (redirect, delegate, return)
in main.php at line 211 (gallerycoreapi::error)
in main.php at line 87
in main.php at line 80

Could anyone give me a pointer as to what is going on here. Greatly appreciated.

 
morton

Joined: 2005-09-19
Posts: 52
Posted: Thu, 2006-04-13 22:34

mohpa: I also have been using ecard for a while and have just updated to G2.1 and ecard0.8. I just checked my send option as all I did was preview during my upgrade to make sure it was working. My send went through without any problems. I might suggest that you go into the Admin - Maint. and empty you caches for templates and database if you have not done so after your up grade. G2 will do that for you if you upgrade the modules at the same time you upgrade G2, but if you just upgrade a module after installing G2.1 it is a manual operation. If that does not work I would deactivate, uninstall ecard and then re-install and reactivate it. Be sure to empty the caches. It sounds like something of version 0.7 is hanging around.

Cheers, Morton

 
mohpa

Joined: 2005-09-16
Posts: 6
Posted: Fri, 2006-04-14 15:20

morton:
thank you for the pointers given. The hangup was in the default Email configuration of Gallery. I removed all of the info, and let it use the PHP's built in mail function. Now it works.
Prost

 
schwos

Joined: 2006-04-15
Posts: 50
Posted: Sat, 2006-04-15 21:43

I am getting this error and can't identify what the issue is. Any help would be appreciated..

Fatal error: Call to undefined function: fopen() in /home/www/huskies/modules/core/classes/GalleryPlatform.class on line 345

Thanks,

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sat, 2006-04-15 22:34

your php must have that function.

 
schwos

Joined: 2006-04-15
Posts: 50
Posted: Sun, 2006-04-16 05:21

Yes it does in fact all on my Gallery 2.x works fine. Just when I come to the point to Send the message it gives this error?? Any more thoughts?

 
rriehl

Joined: 2006-04-16
Posts: 6
Posted: Sun, 2006-04-16 15:51

When I uploaded the module to my gallery, in MODULES it says:
Send photos as eCards
Incompatible module!
Core API Required: 6.0 (available: 7.2)
Module API Required: 2.0 (available: 3.0)

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Sun, 2006-04-16 17:05

rriehl:
Do you have the latest version of the module?

 
rriehl

Joined: 2006-04-16
Posts: 6
Posted: Sun, 2006-04-16 19:02

No... DUH! I downloaded the correct version and it works perfectly. Thank you

 
svejk

Joined: 2006-04-18
Posts: 14
Posted: Thu, 2006-04-20 06:29

this modul is the best ;)
i have two question....
1. which file must use to translate front page of modul (form when visitor of gallery put data when want send e-card some friend).
2. how can i see in administration how many e-card people send from gallery?

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Thu, 2006-04-20 13:03

1. You can translate the strings used in the module just like any other G2 module. It is described here:
http://codex.gallery2.org/index.php/Gallery2:Localization
And of course I'd be happy if you would send me the finished translation so I can include it into future versions

2. This is not implemented yet as the eCard module does not save any data. To make this possible, the module would have to bring a data model to extend the Item records. Not sure if this makes sense...

 
morton

Joined: 2005-09-19
Posts: 52
Posted: Sat, 2006-04-22 01:35

svejk: You can kind of keep up with who and how many ecards are being sent by going to Admin and open the eCard module. In there you will find an eMail BCC: which I put my webmaster email address. I know this is probably not what you were looking for, but at least you do have some idea of how many are being sent by the number of emails you are getting. The sender and receipent do not see BCC's.

 
svejk

Joined: 2006-04-18
Posts: 14
Posted: Sat, 2006-04-22 07:46

yes that was ok...;) Thanks morton....

 
technobilder

Joined: 2003-02-09
Posts: 214
Posted: Tue, 2006-04-25 21:51

When will captcha get included? I wonder when some pammer will find the ecard module worth for bulk mailings ...

 
svejk

Joined: 2006-04-18
Posts: 14
Posted: Wed, 2006-04-26 06:34

and i find onether "bug"...when use ecard and have modul watermark...Gallery show watermark on all pictures but when send ecard...card arive via email without watermark...why?

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-04-26 11:46
technobilder wrote:
When will captcha get included? I wonder when some pammer will find the ecard module worth for bulk mailings ...

Excellent idea...i'll see if i can whip it together :)

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-04-26 12:49

i've got a basic setup almost working now...if i get another hour or two free, i should have it complete and will post code. but that probably won't be till tomorrow...

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-04-26 17:36

alright, i've got working CAPTCHA on the ecard module. I can update it and release it from NukedGallery, or wait and send to nicokaiser for him to release it.

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Wed, 2006-04-26 18:21

dmolavi: I'd love to see it so I can integrate it into the main repository.

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-04-26 18:36

www.themolavis.com has it in action...

PM me with an email address and I can zip the module and send it to you.

 
svejk

Joined: 2006-04-18
Posts: 14
Posted: Thu, 2006-04-27 08:49

dmolavi i send you pm yesterday...
is it arive?

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Thu, 2006-04-27 11:14

svejk - yes, but my updates only included the captcha code, no watermarks. i'll work on watermarks today.

nicokaiser - with your permission, i'm going to clean this up (once i get watermarks working), add unit tests, and add it to the main g2 codebase in SVN. your name will be retained as author.

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Thu, 2006-04-27 12:39

svjek -
Re: watermarks...it the module admin for watermarks, check the "hotlink" radio button next to your watermark image and click the "Save" button. then, activate the URL rewrite module and scroll to the bottom and activate the "watermark hotlinked images" rule. that will watermark the images in your ecard.

 
LarryDoliver

Joined: 2003-12-31
Posts: 35
Posted: Thu, 2006-05-04 22:23

Great Module - Thanks to nikokaiser and dmolavi!!

Would it be possible to send an album in an ecard?

-larry
http://tautologous.com/gallery2

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Sat, 2006-05-06 23:42

send an album, as in send all the photos? that's more like an ebook :)
if you can clarify what exactly you'd like sent, i can work on it.

 
LarryDoliver

Joined: 2003-12-31
Posts: 35
Posted: Sun, 2006-05-07 16:06

I just got back from a vacation, and made a new album with shots from my trip. I'd like to use this feature to send the album thumbnail / link to my family and friends. Right now, the module only allows me to send an imagee thumbnail / link.

http://tautologous.com/gallery2

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Mon, 2006-05-08 18:24

change:

	foreach ($items as $item) {
	    if (GalleryUtilities::isA($item, 'GalleryPhotoItem')) {
		if (!isset($permissions[$item->getId()]['ecard.send'])) {
		    continue;
		}
		$params['view'] = 'ecard.SendEcard';
		$params['itemId'] = $item->getId();
		$params['return'] = 1;
		if (isset($wantsDetailedLinks[$item->getId()])) {
			$links[$item->getId()][] = array('text' => $this->translate('Send as eCard'),
							 'params' => $params);
		}
	    }
	}

to

	foreach ($items as $item) {
		if (!isset($permissions[$item->getId()]['ecard.send'])) {
		    continue;
		}
		$params['view'] = 'ecard.SendEcard';
		$params['itemId'] = $item->getId();
		$params['return'] = 1;
		if (isset($wantsDetailedLinks[$item->getId()])) {
			$links[$item->getId()][] = array('text' => $this->translate('Send as eCard'),
							 'params' => $params);
		}
	}

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Tue, 2006-05-09 20:07

What exactly happens when you change this code? Don't the e-mail templates complain about not being able to generate a thumbnail?

 
gmorales

Joined: 2006-04-23
Posts: 4
Posted: Tue, 2006-05-09 20:37

Hi,

eCard works fine for me, but I can have this as an action only when I am logged as admin. How could I add a simple icon allowing visitors to send eCards on a photo page?

Thank you,

Gérald

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-05-10 01:18

nicokaiser-
was that directed to me? if so, it works perfectly on my site (www.themolavis.com), try it and see :)

 
schwos

Joined: 2006-04-15
Posts: 50
Posted: Wed, 2006-05-10 05:54

I am still having issues with e-card. I can see Preview but the Send will return an error of Fatal error: Call to undefined function: fopen() in /home/www/gallery2/modules/core/classes/GalleryPlatform.class on line 345

Any help would be helpful...

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Wed, 2006-05-10 07:24

schwos:
There seem to be PHP configurations around with fopen disabled. I have no idea why this happens and how thie module can detect it as it uses Gallery's wrapper functions for fopen...

dmolavi:
I checked your site but I can't send albums as ecards (that's what I thought the patch would allow)?

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-05-10 10:43

nicokaiser-
you're right, i just tested it...it doesn't complain (no error messages), but there just isn't any thumbnail. mindless, any idea of how to use the album highlight image as the image to be sent, along with the album URI?

 
schwos

Joined: 2006-04-15
Posts: 50
Posted: Wed, 2006-05-10 22:29

How do I reenable fopen?

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Thu, 2006-05-11 11:53

php.ini , i believe. i'm not sure if you can override this via .htaccess or not...

 
GusDoeMatik

Joined: 2006-04-11
Posts: 25
Posted: Fri, 2006-05-12 06:59

dmolavi
Hi there good tips on creating a link from the photo to the site. It works well for me.
But now I need help in adding a link to my site from the email's footer...

example email footer:

Quote:
This eCard was sent from MyDotComHere.com - Your photos on your website.

I want MyDotComHere.com to be a link that leads back to the main page of the site.

Or if you have a revised version of this eCard component, with this function encluded, I'll take that.. :)

 
hunterzzz

Joined: 2006-02-20
Posts: 1
Posted: Sat, 2006-05-13 14:38

I am currently running g2.1.1 core 1.1.0.1 (just recently updated all my modules) and running ecard-module 0.0.8. Preview seems to work fine, but when i send the card to myself as a test, there is no photo at all, however it does show in the preview. Any ideas what to look for? Thanks in advance.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sat, 2006-05-13 15:25

dmolavi, you can use fetchThumbnailsByItemIds on albums just like with data items.. but I think ecard uses that "getSmallestResize" code which probably doesn't work, as an album won't have any resize derivatives. perhaps if that code doesn't find any resizes it should fallback to thumbnail.

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-05-17 19:18

if you want the latest version of this code as it's been folded into the main gallery codebase:

svn checkout https://svn.sourceforge.net/svnroot/gallery-contrib/trunk/gallery2/modules/ecard

code has been cleaned up, and unit tests added. functionality-wise, it's the same as the one offered from siriux, with one addition: captcha.

 
dmolavi
dmolavi's picture

Joined: 2002-12-05
Posts: 569
Posted: Wed, 2006-05-17 19:45

GusDoeMatik-
In SendEcard.inc find:

$data['footer'] = nl2br($data['footer']);

After Add:
GalleryUtilities::unsanitizeInputValues($data['footer'], false);

Once i find a safe way to add this (to prevent injection exploits, etc), this will be put into SVN.

 
nicokaiser

Joined: 2004-10-04
Posts: 118
Posted: Thu, 2006-05-18 07:00

That's great to see that the module is in the mail code tree! :-)

Could you bump the version to something bigger than 0.1.0? I recently released version 0.1.0 which fixes a bug when BCC is left empty:

http://siriux.net/news/2006/05/16/gallery-2-ecard-module-009/

AttachmentSize
fix_empty_bcc.patch.txt628 bytes