[Unsupported]: Email images to your gallery - Page 2 [Unsupported]: Email images to your gallery - Page 2
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[Unsupported]: Email images to your gallery

Started by rphMedia, July 17, 2006, 08:30:16 AM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

rphMedia

For some reason, after updating to cpg1.4.9, this mod is broke.

Fatal error: Call to undefined function: is_known_filetype() in /homepages/38/d92220195/htdocs/rphgallery/include/picmgmt.inc.php on line 38

I'll be investigating in the next few days, but if anyone has any insight, please let me know.



The scripts, without the integration, still work.

Sami

check this file :include/media.functions.inc.php
and re-upload it
‍I don't answer to PM with support question
Please post your issue to related board

rphMedia

Quote from: bmossavari on September 02, 2006, 02:36:16 PM
check this file :include/media.functions.inc.php
and re-upload it

I actually tried that, didn't work.

Sami

I don't see any differences between 1.4.8 ver and 1.4.9 version of thoes files !
‍I don't answer to PM with support question
Please post your issue to related board

rphMedia

Yeah, thanks for looking into it.  Something is definitely wrong.  I just tried to edit an image and nothing happens (blank output).  I've never used the edit feature before, so I don't know what to compare it to. 

But it also needs picmgmt.inc.php .... more troubleshooting.

rphMedia

Nothing broke - didn't modify case 'anycontent?' in index.php  ::)

lhenke

Hello!

I have tried to install this function, but without any luck.

I created a folder within the album directory, chmod the folder to 777.
I have a mailbox for the incoming files, and have put the information needed to the newcam.php, such as mail host, username, password, gallery #, and album paths..
In the index.php I changed the case for anycontent to anycontent1.php, this is the file I uploaded to my webserver.
In the settings for cpg I changed in the albumlist to anycontent1.

When I send mms to the mailbox I see that the files are there, but nothing happends in the gallery.
It seems like the script doesnt check the mailbox, is there any way I can debug this or anyone have a clue what I have missed :) .

I'm runnig cpg149..

Best Regards.

rphMedia

With the exception of your email password, show me every snippet of code (that you modified or otherwise) and I should be able to tell you where it's gone wrong. 

Reagarding anycontent - if you don't currently use anycontent, you can simply change the filename to anycontent.php and configure/add accordingly.  I only changed the name so novices wouldn't overwrite their current anycontent.php file.  So, you may want to undo your changes to index.php, change the name of anycontent1.php to anycontent.php and start from scratch there.

lhenke

Hey!

I fixed it, I debuged newcam.php and the script connected to the mailbox and read the message but didnt find the attachment, and I dont know if there is a diffrent in mms settings for providers in Europe / US ?
Cause the mms I tried to send was attached and the script was looking for inside (disposition) so I had to modify the script to check for both type's of attachment, so now its working :D

//H

rphMedia

I'm glad you got it working.  Most don't return once they have it working - thanks for the feedback, it may help others.

jahumphr

I get this error....any ideas?

can't connect: Certificate failure for kycities.com: self signed certificate: /C=--/ST=SomeState/L=SomeCity/O=SomeOrganization/OU=SomeOrganizationalUnit/CN=localhost.localdomain/emailAddress=root@localhost

newcam.php:

<?php

define('IN_COPPERMINE', true);

require('include/picmgmt.inc.php');

require_once("attachmentread.class.php");

$host="{kycities.com:110/pop3}"; // pop3host

$login="pix"; //pop3 login

$password="*****"; //pop3 password

$filepath=$_SERVER["DOCUMENT_ROOT"]."/albums/pix/";  ; // attachement will save in same directory where scripts run, otherwise give abs path

$album="81"; // album id #

$folder = "pix/"; // foldername with a /

$jk=new readattachment(); // Creating instance of class####

$jk->getdata($host,$login,$password,$filepath,$album,$folder); // calling member function

?>

rphMedia

You need to ensure that kycities email box will support this method.  Also, double check that host address, most will be something like pop.kycities.com ... for the pop3 connect.

jahumphr

I had to modify newcam.php to get it to work.

$host="{mail.kycities.com:110/pop3/novalidate-cert}"; // pop3host

It is working now via email but when I use MMS it deletes the email but does not copy the attached pic to the /pix folder and does not post to the gallery. Could this be because of the attached txt file also?

Also I am able to upload a .3gp(quicktime) video file via email but it will not play. If i download the same video from the email it plays on my pc. When i ftp the same file from the /pix directory to my pc it will not play....any ideas.


jahumphr

I left off the fact that if you dont include a subject and some text in the body the email attachment will not post.

rphMedia

Quote from: jahumphr on November 28, 2006, 03:16:48 AMIt is working now via email but when I use MMS it deletes the email but does not copy the attached pic to the /pix folder and does not post to the gallery. Could this be because of the attached txt file also?
No idea, works from my cellphone.  Don't think it's because of the text file because I can easily attach two items to my email and it works. Again, could be the email client and how they process incoming messages.

Quote from: jahumphr on November 28, 2006, 03:16:48 AMAlso I am able to upload a .3gp(quicktime) video file via email but it will not play. If i download the same video from the email it plays on my pc. When i ftp the same file from the /pix directory to my pc it will not play....any ideas.
Beyond the scope of this mod.  That's a Coppermine config problem - search the boards, there's info on 3gp's out there.

Quote from: jahumphr on November 28, 2006, 03:16:48 AM
I left off the fact that if you dont include a subject and some text in the body the email attachment will not post
I send pictures without subject AND body text all the time.  Once again, you may want to try a different email host ('novalidate-cert' - no idea what that is, but could be part of your problem).

rphMedia

I apologize if some have sent emails to test, I use the site as a test platform and I inadvertantly removed the anycontent file associated with this mod.

Back on & works again.  Sorry 'bout that.

zapakh

Quote from: lhenke on September 06, 2006, 03:03:16 PM
Hey!

I fixed it, I debuged newcam.php and the script connected to the mailbox and read the message but didnt find the attachment, and I dont know if there is a diffrent in mms settings for providers in Europe / US ?
Cause the mms I tried to send was attached and the script was looking for inside (disposition) so I had to modify the script to check for both type's of attachment, so now its working :D

//H

I think I encountered the same difficulty.  In attachmentreadclass.php I modified

if($part->disposition == "ATTACHMENT")

to read

if($part->disposition == "ATTACHMENT" || $part->disposition == "INLINE")

Thereafter, I could MMS-email from my phone and have the images show up.

Great mod!

zapakh

Quote from: rphMedia on August 28, 2006, 09:41:17 PM
As far as reading the body of an email (to add a description to the image), I'm sure it could be done, but I don't have the time right now  :P
As an example of something similar, I have modified my copy of the script to add a Title to the image from the Subject of the email, if one is provided.

In attachmentread.class.php, just after

        for ($jk = 1; $jk <= imap_num_msg($mbox); $jk++)
        {

insert the lines

        $headerinfo = imap_header($mbox, $jk);
        $subject = $headerinfo->Subject;


Also in attachmentread.class.php, later on, alter the line

                        add_picture($album, $folder, $filename);

so that it looks like

                        add_picture($album, $folder, $filename, 0, $subject);

The 0 argument is the default value for the $position argument of add_picture().

One additional issue... In sending MMS from my cell phone, the resulting emails would have a subject line like

Subject: =?utf-8?B?Rmxvd2VycyE=?=


which apparently means it has encoded a utf-8 encoded subject using base64.  I worked around this by inserting an ugly hack consisting of the following lines just below the $headerinfo->Subject bit:


                        $matches = array();
                        if (preg_match('/^=\?[^?]*\?B\?(.*)\?=/m', $subject, $matches))
                                $subject = base64_decode($matches[1]);


This resulted in the desired behavior for this specific case, but does anyone know the Right Way to make sense of such a subject line in PHP?


zapakh

I was testing the email functionality from a friend's cell phone, using a different wireless provider, and the pictures failed to show up in the gallery.

I inspected the emails that were arriving gallery-side, and discovered that through this particular phone/service/gateway configuration, those emails were arriving without any Content-Disposition headers to be seen.  This is doubly bad because the script relies on the existence of a filename attribute on that header.

My solution was to replace


  if($part->disposition == "ATTACHMENT")
  {
  ...
  $params = $part->dparameters;
  $filename=$part->dparameters[0]->value;


with


  if(TRUE)
  {
  ...
                if ($part->ifdparameters)
                  foreach($part->dparameters as $dparam)
                    if (strtolower($dparam->attribute) == 'filename') $filename = $dparam->value;
                if (empty($filename))
                  if ($part->ifparameters)
                    foreach($part->parameters as $param)
                      if (strtolower($param->attribute) == 'name') $filename = $param->value;
                if (empty($filename)) $filename = 'nfn' . rand() . '.' . strtolower($part->subtype);


This snippet looks for a 'filename' attribute on Content-Disposition, followed by a 'name' attribute on Content-Type, and finally generates a random filename if all else fails.  It corrected my problem.

rphMedia

zapakh, thanks much for all the refinements.  I just haven't had a lot of time to detail the code.  Seems you're doing my homework.  I'll look into them later and update the attachments if required ...

Keep it up !