Photo Upload in 1.2.1 Not Working

48 views
Skip to first unread message

David C

unread,
Oct 27, 2009, 10:28:29 AM10/27/09
to Magic Fields
I've noticed that the image uploading field doesn't work for me in
1.2.1.

When I select a file to use, it says "Transferring" but then never
displays a thumbnail preview of the image. Nor does it actually
display the image on the live page.

I looked through the "files_mf" folder and it is actually
successfully moving the image file into that folder, but for some
reason is not being displayed on the live page when I use the get();
function to pull in the image address.

I right clicked the image on the live page to check the image address,
and it's generating the image address as my root folder(http://
localhost:8888/).

This is the code I used to pull in the image previous: <img
class="img_normal" src="<?php echo get('home_image'); ?>" width="366"
height="228" />


Thoughts?

HighToro

unread,
Oct 27, 2009, 11:30:31 AM10/27/09
to Magic Fields
In my case (localhost mode - Win-XAMPP) the message is "Upload
Unsuccessful!" with 1.2.1.
That work's well in 1.1.

Hunk

unread,
Oct 27, 2009, 12:21:02 PM10/27/09
to Magic Fields
ok, try with this, replace this line ( in Main.php line 220 )

function valid_mime($file_path,$file_type){

for

function valid_mime($file_path,$file_type){ return true;

and check again, please

HighToro

unread,
Oct 27, 2009, 1:52:48 PM10/27/09
to Magic Fields
Yes Hunk, thank you, is in this function the trouble... without that
checking the image pass ok.

King regards.

David C

unread,
Oct 27, 2009, 6:05:12 PM10/27/09
to Magic Fields
Thanks, that fixed the issue.

Why am I editing this line of code on my own? (instead of it being a
bug?) Is it doing this because solely it's a locally based site? Will
I have to change this code back when I put it up on the web?

Also, now that uploading works, that's great. But the preview of the
image in the Write Panel still doesn't work. It shows a blue-ish
background with the red text saying:

phpThumb() v1.7.9-200805132119

Error opening
"http://localhost/wp-content/files
.png":

404 Not Found

David Valdez

unread,
Oct 27, 2009, 6:20:29 PM10/27/09
to magic-...@googlegroups.com
Hi David C. In this last release was implemented a new way to validate the files but something is wrong on this.

The fix published is just temporal, i'm working in fix completely this issue. 

I don't sure why is displayed the background blue, but i'm are investigating this issue. 

Thanks for your patience

David C

unread,
Oct 27, 2009, 6:43:23 PM10/27/09
to Magic Fields
Oh ok. Thanks for the info.

You guys are doing a great job with Magic Fields. I love it!

dmc

unread,
Oct 28, 2009, 8:28:12 AM10/28/09
to Magic Fields
It seems that your local site is running on a domain with port.
can you confirm this?
s/th like http://localhost:8888/

if so, i have a solution for you.

David C

unread,
Oct 28, 2009, 1:59:04 PM10/28/09
to Magic Fields
Yes, it's 8888.

I use MAMP to run the site locally. The only reason I use the port is
so I don't have to type in my password every time I start up MAMP. If
you use the default it causes you to type in your password for some
reason.


On Oct 28, 7:28 am, dmc <daniel.mitsc...@gmail.com> wrote:
> It seems that your local site is running on a domain with port.
> can you confirm this?
> s/th likehttp://localhost:8888/

David Valdez

unread,
Oct 28, 2009, 2:07:56 PM10/28/09
to magic-...@googlegroups.com
Maybe that is a bug...

if you use the default port  is displayed the blue image instead of the preview? or only fail when you use a different port?

Maybe  for that doesn't work the preview image.


David.

dmc

unread,
Oct 28, 2009, 3:50:22 PM10/28/09
to Magic Fields
I had the same problem.
the "bug" is in phpthumb as the port is getting lost on its way
through the code.
i debugged the whole phpthumb addon to find the "error".

go to /plugins/magic-fields/thirdparty/phpthumb.php

on line 530 you will find this code:

$cleanedupurl = phpthumb_functions::CleanUpURLencoding($phpThumb-
>src);
$phpThumb->DebugMessage('CleanUpURLencoding('.$phpThumb->src.')
returned "'.$cleanedupurl.'"', __FILE__, __LINE__);
$phpThumb->src = $cleanedupurl;
unset($cleanedupurl);

you have to comment line 532 (that's where the port gets lost)
afterwards it should look like this (just added the two slashes):

$cleanedupurl = phpthumb_functions::CleanUpURLencoding($phpThumb-
>src);
$phpThumb->DebugMessage('CleanUpURLencoding('.$phpThumb->src.')
returned "'.$cleanedupurl.'"', __FILE__, __LINE__);
//$phpThumb->src = $cleanedupurl;
unset($cleanedupurl);


should be ok for a development environment, as it's only needed there.
you might not want to do this in production use, as i didn't check
what the function is used for.
but you won't have a port in production use so no need to change
anything in the original code.

dmc

unread,
Oct 28, 2009, 3:56:38 PM10/28/09
to Magic Fields
by the way, this i not a magic fields bug and the problem also
appeared in v1.1.
Reply all
Reply to author
Forward
0 new messages