Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-04-05 02:19:47
- jesper
- Member
- From: Melbourne, Oz
- Registered: 2004-03-05
- Posts: 18
Moblog Hack - Post to Textpattern from your mobile phone or by email
Seeing that no one seems to have done a plugin or any other darn thing for this purpose I did a standalone php page hack to accomplish this sort of functionality.
It works pretty well , but since I am not really a coder I am sure it could be done a lot neater and probably also as a plugin – however I didn’t know where and how to start that so instead this stand alone thing that just dumps messages and attached images into your Textpattern site.
Pick it up here:
http://files.krusedulle.net/moblog.txt
Change the .txt extension to .php and edit all the variables at the top of the script to match your system / setup. That is pretty much it.
Hope someone else finds it useful.
Update: This allows you to post messages and pictures via your mobile or email. You can send your messages to an email address as an MMS including pictures. This offers a flat fee over the rather insulting GPRS and other data plans offered by some carriers and some plans.
Last edited by jesper (2007-04-06 03:46:21)
Offline
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
I just talked about this on my blog.
I’m able to log-in and post straight from my BlackBerry 7100t. Just thought I’d throw it out there!
Offline
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
Jesper, this is awesome, really.
I would like to add on, that required pear libraries also include
Net_socket_php
which is required by
Net_pop3.php
to work.
I am modifying your solution for an art project currently.
Thanx very much.
I am having problems to store the actual image data from the mobile phone email attachments, but i will post a solution, as soon as i found it.
I guess it is a permissionm problem on my server, probably so.
I appreciate any hints, of course!
Thank you very much, again!
A hole turned upside down is a dome, when there’s also gravity.
Offline
#4 2007-05-03 22:30:49
- jesper
- Member
- From: Melbourne, Oz
- Registered: 2004-03-05
- Posts: 18
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
My script saves the image in the moblog.php location first in the original dimensions it comes in at from the PXT or email. It then resizes and saves the resized image in the textpattern image directory.
You end up with the image twice meaning you can revisit the original if the resize looks crap. It is there and you can photoshop the life out of it to make it a better photo than the simple resize did.
If this doesn’t work it does sound like a filesystem permission problem.
If you only have FTP access to your host try to use FileZilla and then use the properties dialog on directories to set the permissions. Works well on my host.
Last edited by jesper (2007-05-03 23:05:15)
Offline
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
thank you jesper,
filepermissions don’t seem to be the problem.
i am running this on a shared host with php 4.4.6 – could that be the reason of trouble?
the script doesn’t appear to grab the attachment from teh mail – $tmp is empty.
thanx in advance, please forgive my support calls 8-)
Last edited by jayrope (2007-05-04 17:40:39)
A hole turned upside down is a dome, when there’s also gravity.
Offline
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
update: solved.
notes:
- realized this WITHOUT complete pear installation (due to shared ip server host rejected to install PEAR)
— instead created folder “pear” in textpattern folder containing
/Mail/mimeDecode.php
/Net/Pop3.php
/Net/Socket.php
PEAR.php
System.php (might not be needed)
- access permissions on folder containing moblog.php need be 777.
- necessary changes i had to make to your moblog.php were:
line 144 $tmp=$tmpObj->d_parameters[‘filename’];
was changed to $tmp=$tmpObj->ctype_parameters[‘name’];
php version 4.4.6 on Linux/Apache 1.3.37
i hope that helps someone.
A hole turned upside down is a dome, when there’s also gravity.
Offline
#7 2007-05-06 12:12:13
- jesper
- Member
- From: Melbourne, Oz
- Registered: 2004-03-05
- Posts: 18
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
Sorry I was away for he weekend. I run it on a shared host with PHP 5 something maybe that is why you had to make some minor edits.
Cheers,
/Jesper
Offline
#8 2007-05-30 04:42:17
- szac
- Member
- From: Detroit-ish
- Registered: 2004-09-18
- Posts: 50
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
Great stuff man. Thanks
How do I go about activating that thumbnail function? Looks sweet!
Offline
#9 2007-06-06 01:57:00
- szac
- Member
- From: Detroit-ish
- Registered: 2004-09-18
- Posts: 50
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
Hi Jesper,
Everything’s working great except my image colors are being “posterized” or inverted. It’s really strange. Any ideas? I’ve set the compression to 10 and 0 with no change.
Also, got the thumbnail part. I think you were just suggesting about specifying the size.
Thanks again man.
Offline
#10 2008-04-23 10:18:27
- jamm1n
- Member
- Registered: 2008-04-23
- Posts: 19
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
Hi there,
This is coool
I’m lovin the idea of getting this to work :)
after much fiddling with pear packages and include paths (n00b when it comes to this….)
I have got as far as including the packages, i am pretty sure the connection to the database is being made, but my page is now displaying the following:
——————————————————————————————-
getNumMsg
2
Tag error: <txp:php> -> Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘home/xxxx/public_html/images/62.jpg’ for writing: No such file or directory on line 405
Warning: image_info() => first argument must be a file.
Warning: image_info() => first argument must be a file.
INSERT INTO txp_image (name, ext, w, h, alt, caption, date, author, thumbnail) VALUES (‘biig-rabbit.jpg’, ‘.jpg’, , , ‘biig-rabbit.jpg from mobile phone’, ‘biig-rabbit.jpg from mobile phone’, ’2008-04-23 10:25:30’, ‘ben’, 0 )Error, query failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ , ‘biig-rabbit.jpg from mobile phone’, ‘biig-rabbit.jpg from mobile phone’, ‘20’ at line 2
——————————————————————————————————————
can anyone help me get past this bit? I re-checked passwords and this page, but the “error in SQL syntax” bit made me think it something else…..
apologies for my complete lack of knowledge in this area, still, gotta start somewhere :s
my txp install is on:
Apache 1.3.41 (Unix)
php 5.2.2
mySQL 5.0.45-community
I too am on shared IP. the pear packages were already installed on my shared server by my sys admin, so my include path points to them. It seems to be working ok but I am flying blind atm.
Thanks in advance,
Ben
Offline
#11 2008-04-24 00:01:57
- jesper
- Member
- From: Melbourne, Oz
- Registered: 2004-03-05
- Posts: 18
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
jamm1n wrote:
Tag error: <txp:php> -> Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘home/xxxx/public_html/images/62.jpg’ for writing: No such file or directory on line 405
This is the actual error that seems to cause all the other errors.
Can you check you have a path named as above on your host? It looks alot like the path on my host with xxxx replacing my userid. You should modify this to match the absolute path for your textpattern image directory on your host.
Warning: image_info() => first argument must be a file.
Can’t find the file above again….
Warning: image_info() => first argument must be a file.
Can’t find the file above again….
The two commands above attempts to find the width and the height of the image. the SQL below fails because the values for vidth and height are both NULL.
INSERT INTO txp_image (name, ext, w, h, alt, caption, date, author, thumbnail) VALUES (‘biig-rabbit.jpg’, ‘.jpg’, , , ‘biig-rabbit.jpg from mobile phone’, ‘biig-rabbit.jpg from mobile phone’, ’2008-04-23 10:25:30’, ‘ben’, 0 )Error, query failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ , ‘biig-rabbit.jpg from mobile phone’, ‘biig-rabbit.jpg from mobile phone’, ‘20’ at line 2
So basically fix up the absolute path to your textpattern image folder and all should be good.
Offline
#12 2008-04-24 09:17:26
- jamm1n
- Member
- Registered: 2008-04-23
- Posts: 19
Re: Moblog Hack - Post to Textpattern from your mobile phone or by email
thanks Jesper!
oops yeah it was that leading / before home. ….. after all that head scratchin….
its working now, :) but I think the way I am calling the page must be wrong.
Once again, I apologise for my lack of knowledge with php,
I was using <code><txp:php>include(‘/home/xxxx/public_html/path/to/moblog.php’);</txp:php></code>,
(this displays either no page / blank page with moblog.php being executed at the top)
I have also tried setting up cron job: wget http://www.domain/path/to/moblog.php which returns 404 errors.
I wouldn’t normally ask for a solution to such a simple question, but my brains in knots!
thanks for all your help.
Ben
Offline