Keyword

Adding Item image fails (image prefix error?)

  • ROLF ERIK PAULSEN
  • ROLF ERIK PAULSEN's Avatar Topic Author
  • Offline
  • New Member
More
14 years 9 months ago #69799 by ROLF ERIK PAULSEN
Replied by ROLF ERIK PAULSEN on topic Adding Item image fails (image prefix error?)
Just for information:
I Checked md5 on my server by creating a simple php page and trying echo md5("hello"), and that worked. So it seems like md5 is configured properly on my server.

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #69800 by Dave Arnesen
Replied by Dave Arnesen on topic Adding Item image fails (image prefix error?)
Hi Lefteris,
The caption and credit are saved with the content item, but no image is displayed.

I've looked in the folder and there are no files in the cache directory, although it is writeable and I have even tried with 777 permission.

Thanks!
Dave

Lefteris Kavadas said:Are you having exactly the same issue? Or your images aren't uploading at all? Did you get any files in the directory media/k2/items/cache? Dave Arnesen said:I too have this problem, all folder permissions are ok, but images don't upload - the server is configured ok to use md5 - any updates on this issue? Lefteris Kavadas said:Hi again. This is very weird. The routine that generates the prefix uses php's md5() function. It seems that for some reason php's md5() fails. Is it possible that this function is disabled by the server configuration? I suggest that you do some further research on this as i cannot reproduce this bug and no one else has reported something similar in the past.

Please Log in or Create an account to join the conversation.

  • ROLF ERIK PAULSEN
  • ROLF ERIK PAULSEN's Avatar Topic Author
  • Offline
  • New Member
More
14 years 9 months ago #69801 by ROLF ERIK PAULSEN
Replied by ROLF ERIK PAULSEN on topic Adding Item image fails (image prefix error?)
Hi Lefteris and Dave (or anybody else with a suggestion :),
do you have any suggestions as to how I could debug this problem? I can not find any errors in the logs (maybe I have not been able to turn them on properly), and no other error-indication shows up when uploading image.

Btw, when using RokStories with a "regular" inline image (which I can see in the article), the image is not displayed as the big feature picture. The RokStories "arrows" on each side of the big picture is there, but no picture - just the loading-placeholder is shown instead of the image on the site.

I have also tried reinstalling several times :)

Could encoding be a cause? UTF-8 ?

I'm kind of stuck here ... any help would be appreciated :) Thanks

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #69802 by Dave Arnesen
Replied by Dave Arnesen on topic Adding Item image fails (image prefix error?)
Yeah still no progress for me, I also can't see any errors in the server logs but nothing is being uploaded to the k2 image directory.

Regarding RokStories; have you got the latest version of this from RocketTheme? I know they have recently released upgrades of some modules to make them k2 compatible, not sure if they have done for RokStories.

Dave

Rolf Erik Paulsen said:Hi Lefteris and Dave (or anybody else with a suggestion :), do you have any suggestions as to how I could debug this problem? I can not find any errors in the logs (maybe I have not been able to turn them on properly), and no other error-indication shows up when uploading image.

Btw, when using RokStories with a "regular" inline image (which I can see in the article), the image is not displayed as the big feature picture. The RokStories "arrows" on each side of the big picture is there, but no picture - just the loading-placeholder is shown instead of the image on the site.

I have also tried reinstalling several times :)

Could encoding be a cause? UTF-8 ?

I'm kind of stuck here ... any help would be appreciated :) Thanks

Please Log in or Create an account to join the conversation.

  • ROLF ERIK PAULSEN
  • ROLF ERIK PAULSEN's Avatar Topic Author
  • Offline
  • New Member
More
14 years 9 months ago #69803 by ROLF ERIK PAULSEN
Replied by ROLF ERIK PAULSEN on topic Adding Item image fails (image prefix error?)
I tried installing the previous version v1.0.2 Beta..... and the image upload worked !

All of a sudden, I found that I had two k2 directories under media... one "k2" and one "K2". In UNIX/Linux world... these are two completely different names... whereas on my XAMPP installation (Windows) where everything works - they are not :)

I then tried reinstalling the v2.0.0, and saw that it operated with "k2". I manually tried to rename the folder to "K2", but all that happened during image upload was that a new "k2" folder was generated with a subfolder for "items/cache" containing the _Generic.png files.

But this leads me to a question.... has anybody managed to get v2.0.0 to run in a Unix/Linux environment where file- and directory names are case sensitive?

Can there be an inconsistency in the code when performing operations (md5 ?), where the folder name "k2" is used to store files - but then the md5 command is run on a file in the "K2" folder (or some other combination to that effect?)

Please Log in or Create an account to join the conversation.

  • ROLF ERIK PAULSEN
  • ROLF ERIK PAULSEN's Avatar Topic Author
  • Offline
  • New Member
More
14 years 9 months ago #69804 by ROLF ERIK PAULSEN
Replied by ROLF ERIK PAULSEN on topic Adding Item image fails (image prefix error?)
It seems like it might be a problem with the case sensitivity running k2 under UNIX/Linux. The image upload worked fine in previous version of k2. The issue might be the name of the k2 directory; if k2 and K2 are both used in the code ?

Has anybody managed to get item image upload to work under Unix/LInux?

Please Log in or Create an account to join the conversation.

  • ROLF ERIK PAULSEN
  • ROLF ERIK PAULSEN's Avatar Topic Author
  • Offline
  • New Member
More
14 years 9 months ago #69805 by ROLF ERIK PAULSEN
Replied by ROLF ERIK PAULSEN on topic Adding Item image fails (image prefix error?)
After a lot of debugging, I have managed to locate where the code fails... and a way around it..

class.upload.php in /administrator/components/com_k2/lib returns 'incorrect_file'.
This only happens for the first original file that is to be saved under the /src folder, this also causes the file-name to not be generated (returned) correctly. The /cache images are saved correctly, but without file-name which is not returned from the original file.

For the first file, this is the metadata inside class.upload.php process() method:
this->file_src_mime: audio/x-mod

In the following process-method loop check for mime values:
foreach($this->allowed as $k => $v) {
$log->lwrite(' checking '.$k.' => '.$v);
list($v1, $v2) = explode('/', $v);
if (($v1 == '*' && $v2 == '*') || ($v1 == $m1 && ($v2 == $m2 || $v2 == '*'))) {
$log->lwrite('one is allowed...');
$allowed = true;
break;
}
}
This produces the following log:
checking 0 => image/*

For the other generated files _Generic.jpg, _L.jpg etc... about twenty mime-values are looped through, but only one for the first...

By bypassing the mime-check I get the upload to work correctly... but not the best solution...
if (!$allowed && 1 < 0) { // Make sure this never happens....
$this->processed = false;
$this->error = $this->translate('incorrect_file');
} else {
$this->log .= '- file mime OK : ' . $this->file_src_mime . '';
}

Again, I reiterate that the original code works fine on my xampp server on my windows machine.

Does that help you guys that work with this code? Do you have any idea as to why the mime-check fails (I try uploading both .png and .jpg files).

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #69806 by tommy huang
Replied by tommy huang on topic Adding Item image fails (image prefix error?)
I have the same problem. I found that in the src folder the image was upload there but in the cache folder there are no other prefix image added.

I've checked the folder's permission which is writable(running on a mac with Cmd+I function).

Please help...

Thank you!

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #69807 by Lefteris
Replied by Lefteris on topic Adding Item image fails (image prefix error?)
Hi. The class that K2 uses for uploading is class.upload.php by Colin Verot. As it appears mime detection fails in some systems. Maybe the new version (0.28) of class.upload.php resolves this issue. We have to make some further research on this.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #69808 by Lefteris
Replied by Lefteris on topic Adding Item image fails (image prefix error?)
Hi. Can you please attach one image file that fails?

Rolf Erik Paulsen said:After a lot of debugging, I have managed to locate where the code fails... and a way around it..
class.upload.php in /administrator/components/com_k2/lib returns 'incorrect_file'.
This only happens for the first original file that is to be saved under the /src folder, this also causes the file-name to not be generated (returned) correctly. The /cache images are saved correctly, but without file-name which is not returned from the original file.

For the first file, this is the metadata inside class.upload.php process() method:
this->file_src_mime: audio/x-mod

In the following process-method loop check for mime values:
<br/>
foreach($this-&gt;allowed as $k =&gt; $v) {<br/>
$log-&gt;lwrite(' checking '.$k.' =&gt; '.$v);<br/>
list($v1, $v2) = explode('/', $v);<br/>
if (($v1 == '*' &amp;&amp; $v2 == '*') || ($v1 == $m1 &amp;&amp; ($v2 == $m2 || $v2 == '*'))) {<br/>
$log-&gt;lwrite('one is allowed...');<br/>
$allowed = true;<br/>
break;<br/>
}<br/>
}<br/>
This produces the following log:
checking 0 =&gt; image/*

For the other generated files _Generic.jpg, _L.jpg etc... about twenty mime-values are looped through, but only one for the first...

By bypassing the mime-check I get the upload to work correctly... but not the best solution...
if (!$allowed &amp;&amp; 1 &lt; 0) { // Make sure this never happens....
$this-&gt;processed = false;
$this-&gt;error = $this-&gt;translate('incorrect_file');
} else {
$this-&gt;log .= '- file mime OK : ' . $this-&gt;file_src_mime . '';
}

Again, I reiterate that the original code works fine on my xampp server on my windows machine.

Does that help you guys that work with this code? Do you have any idea as to why the mime-check fails (I try uploading both .png and .jpg files).

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum