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

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 2 Guests are viewing this topic.

nolageek

I'm getting the same error that gizmo was getting:

Fatal error: Call to undefined function: imap_open() i


I thought his mod worked with both IMAP or POP3?

Stramm

check with phpinfo if php on your box has been compiled with the imap library enabled

Nibbler

The imap extension works for POP3 aswell.

nolageek

OK, I got them to fix that imap problem, now I'm getting:

Fatal error: Call to undefined function: is_known_filetype() in /home2/sexin/public_html/forum/gallery2/include/picmgmt.inc.php on line 38

nolageek

Here is my newcam.php, BTW:

<?php
define
('IN_COPPERMINE'true);
require(
'include/picmgmt.inc.php');
require_once(
"attachmentread.class.php"); 
$host="{mail.meninshirtandtie.com:110/pop3}"// pop3host 
$login="e-pix@meninshirtandtie.com"//pop3 login 
$password="***********"//pop3 password */
$filepath="/home2/sexin/public_html/forum/gallery2/albums/e-pix/";// attachement will save in same directory where scripts run, otherwise give abs path 
$album="3"// album id #
$folder "e-pix/"// foldername with a /
$jk=new readattachment(); // Creating instance of class#### 
$jk->getdata($host,$login,$password,$filepath,$album,$folder); // calling member function 
?>


Notice, I changed the $filepath a bit, since I wasn't sure what it was asking...  but that should work, huh?

Notice, when I had that path wrong, I got a message about not being able to write ".... path/me.jpg" to the "...../e-pix/" directory..  so, it managed to log in and get the filename from the mailbox... but it didnt clear the mailbox or anything, so I know it at least got that far.

rphMedia

Quote from: nolageek on January 18, 2007, 09:52:23 AM
OK, I got them to fix that imap problem, now I'm getting:

Fatal error: Call to undefined function: is_known_filetype() in /home2/sexin/public_html/forum/gallery2/include/picmgmt.inc.php on line 38

For this error, you simply didn't add your anycontent case to index.php.

I would start from scratch - this works out of the box if you follow the directions exactly.

nolageek

what do you mean 'add your anycontent case to index.php'  I tried both adding include(webcam.php); to the stock anycontent.php and renaming anycontent1.php to anycontent.php (since I wasn't using it anyway.)

Is there something else I have to do to 'enable' anycontent.php? I've been looking.

nolageek

That should be include("newcam.php"); up there. :)  I have just re-installed this, twice.  :)

I mean, it's just uploading three files, configuring one, and chmodding a directory right?  I'm not saying I didn't miss a step, but that I don't think I know what that step is. :)

Here's pretty much everything I've done:

root path is /home2/sexin/public_html

CFG URL is /forum/gallery2

files uploaded to
/forum/gallery2/anycontent.php (I renamed anycontent1.php)
/forum/gallery2/newcam.php (configured as below)
/forum/gallery2/attachmentread.class.php (didn't modify)

/forum/gallery2/albums/e-pix is chmodded 777

My anycontent.php:

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.8
  $Source$
  $Revision: 3116 $
  $Author: gaugau $
  $Date: 2006-06-08 00:11:54 +0200 (Do, 08 Jun 2006) $
**********************************************/

/**
* Coppermine Photo Gallery 1.4.6 anycontent.php
*
* This file file gets included in the index.php if you set the option in admin
* can be used to display any content from any program, it is always to be edited
* according to tastes and then used
*
* @copyright 2002,2005 Gregory DEMAR, Coppermine Dev Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License V2
* @package Coppermine
* @version $Id: anycontent.php 3116 2006-06-07 22:11:54Z gaugau $
*/
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
include(
"newcam.php");
?>




My newcam.php:

<?php
define
('IN_COPPERMINE'true);
require(
'include/picmgmt.inc.php');
require_once(
"attachmentread.class.php"); 
$host="{mail.meninshirtandtie.com:110/pop3}"// pop3host 
$login="e-pix@meninshirtandtie.com"//pop3 login 
$password="**************"//pop3 password */
$filepath="/home2/sexin/public_html/forum/gallery2/albums/e-pix/";// attachement will save in same directory where scripts run, otherwise give abs path 
$album="3"// album id #
$folder "e-pix/"// foldername with a /
$jk=new readattachment(); // Creating instance of class#### 
$jk->getdata($host,$login,$password,$filepath,$album,$folder); // calling member function 
?>


no other files were altered.


Thanks so much, BTW!  :)

rphMedia

Not too sure about the absolute server path ($filepath) - may want to revert to original.

Have you included the anycontent via your Admin Config?

breadcrumb/anycontent/alblist/catlist......

And make sure that your attachment (for starters) is a non-progressive .jpg file, then troubleshoot other file-types from there.

nolageek

Quote from: rphMedia on January 18, 2007, 12:40:37 PM
Have you included the anycontent via your Admin Config?

breadcrumb/anycontent/alblist/catlist......

Nope.  I've been looking for ANY information on this anycontent.php file ...  All I see is hwo to back it up.  I don't see anything about it on the admin config at all.  I even 'expanded all' and did a search for anycontent... nothing.

nolageek

Quote from: nolageek on January 18, 2007, 12:51:56 PM
Nope.  I've been looking for ANY information on this anycontent.php file ...  All I see is hwo to back it up.  I don't see anything about it on the admin config at all.  I even 'expanded all' and did a search for anycontent... nothing.

Aha!  I did a search for breadcrumb/ and found where it was missing.  How is a newbie supposed to know that?! Damn, y'all are makin' me WORK. :)

nolageek

hot diggity that worked!   (I wish this forum let us edit our previous posts.... I hate to keep posting like this)

rphMedia

Quote from: nolageek on January 18, 2007, 12:56:35 PM
How is a newbie supposed to know that?! Damn, y'all are makin' me WORK. :)

It's in the documentation.  It's a good read if you get time  ;)

nolageek

I promised I read.  Promised.  Well, I was looking for 'anycontent.php'

I didnt know what that meant until you said "breadcrumb/anycontent/alblist/catlist......"

It might be obvious to someone who has been using this for a while... but I had NO CLUE what that meant. :)

zapakh

Confidentially, it took me a little too long to find the meaning of "anycontent" as well, as I found this thread very early in my Coppermine experience.  My fellow newbies might fare better if given the hint "Admin, Config, Album list view".

nolageek

hmm. i spoke too soon.  I was able to get it to work one time.  Subsequent pictures are being removed from the mailbox, but not posted.  The one that worked was sent via my gmail account.  The ones that have not worked were sent via MMS message from my phone.

I'm gonna cry if this isn't going to work. I was THRILLED at the idea of being able to post photos from my phone. Grrrrr

nolageek

will try things previous posted on here.  (again, why cant we edit our own posts here?)

nolageek

Quote from: zapakh on January 11, 2007, 08:35:14 PM
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.

Could you be a little clearer with your replacement?  I'm not sure if I got it right or not...

mine before...


  if($part->disposition == "ATTACHMENT")
{
    $message["type"][$i] = $message["attachment"]["type"][$part->type] . "/" . strtolower($part->subtype);
$message["subtype"][$i] = strtolower($part->subtype);
$ext=$part->subtype;
$params = $part->dparameters;
$filename=$part->dparameters[0]->value;

        $mege="";
$data="";
  $mege = imap_fetchbody($mbox,$jk,$fpos); 
$fp=fopen($filepath . $filename,w);
$data=$this->getdecodevalue($mege,$part->type);

fputs($fp,$data);
fclose($fp);
add_picture($album, $folder, $filename, 0, $subject);
$fpos+=1;


and after


if(TRUE)
{
    $message["type"][$i] = $message["attachment"]["type"][$part->type] . "/" . strtolower($part->subtype);
$message["subtype"][$i] = strtolower($part->subtype);
$ext=$part->subtype;
                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);
$params = $part->dparameters;
$filename=$part->dparameters[0]->value;

        $mege="";
$data="";
  $mege = imap_fetchbody($mbox,$jk,$fpos); 
$fp=fopen($filepath . $filename,w);
$data=$this->getdecodevalue($mege,$part->type);

fputs($fp,$data);
fclose($fp);
add_picture($album, $folder, $filename, 0, $subject);
$fpos+=1;

zapakh

This is what I intended, except that you should also remove the two lines that say

$params = $part->dparameters;
$filename=$part->dparameters[0]->value;

immediately after the edited portion.

The $params line is harmless, but the $filename line would result in MMS-originated photos failing to appear for one of the wireless providers I tested, because the dparameter it's looking for may fail to exist, and we can't write to a file that doesn't have a name.

Not all wireless providers have been tested.  If pictures continue to fail to appear, it might be helpful to see the email headers you get when MMSing a photo to yourself.

nolageek

This is driving me crazy!  This is compounded on with the fact that my internet got cut off last night, so I wont be able to test this anymore after I leave the coffee shop.


Here's the result of my experiments:

If I MMS it directly to the e-mail address on my domain, it doesn't work.  newcam.php runs, the file is removed from the mailbox but doesn't get copied to the directory nor appear in the gallery.

If I MMS it directly to my gmail account, then forward it via a FILTER to my domain's email address, not only it doesn't work but the message never gets forwarded. (does my domain block server-level forwards?)

If I MMS it directly to my gmail account, then forward it MANUALLY, it works just fine.

If I MMS is directly to a forward rule on my domain, to gmail FILTER to e-mail address on my domain, it doesn't work.  newcam.php runs, the file is removed from the mailbox but doesn't get copied to the directory nor appear in the gallery.

Can't connect to gmail directly.