Keyword

K2 src and cache not writing

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago - 5 years 11 months ago #172156 by Andrew
K2 src and cache not writing was created by Andrew
Hi Everyone,

Following a Joomla and K2 update (and change of server location), K2 is not generating contents in the src and cache folder in the backend. After many forum searches and fix attempts, I am still puzzled about why this is not working.

The problem is as follows, I write an article and add an image via the image tab. I have a success message upon save and I see a record enter the K2 item table. The image will not process and display. The image is not uploaded to the src folder, nor processed by the cache. Images can be uploaded via the server image/K2 media interface but they will not attach to the article.

I’ve checked the sever configuration (all PHP items are fine, including GD2). I’ve checked the caches with main Joomla cache disabled. I can upload to Joomla and the article image is fine. I’ve checked the === issue (no problem - already updated). I’ve check post_max and upload_max (all fine). I’ve inspected the code via Firefox developer tools (all fine). K2 writes to the database so I cannot get an error in the developer options of Joomla or the logs (a green, success message). I’ve trebled checked all permissions and they are set correctly.

I’ve disabled plugins and switched them on one by one.

Finally, I’ve shifted the site to a development area and upgraded PHP to version 7 and the problem persists. All old items and images display correctly. I’ve also tried changing themes.

Are there any K2 and IIS web-server incompatibilities?
Last edit: 5 years 11 months ago by Andrew.

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

More
5 years 11 months ago #172158 by JoomlaWorks
Replied by JoomlaWorks on topic K2 src and cache not writing
This probably points to file ownership issues. Are you able to upload something on the site using e.g. the K2 Media Manager?

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

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago - 5 years 11 months ago #172168 by Andrew
Replied by Andrew on topic K2 src and cache not writing
Hi Fotis, thanks for getting in touch. Yes, no problem uploading via the media manager.

I’m not sure if this adds anything more to solving the problem but I cannot upload an avatar image to the K2 user profile. Still, nothing in the error logs and I get the success message as though everything is fine.

I can also successfully add attachments via the Attachments tab and they display on the article.

After looking at the param paths (image v attachment) both are structured in a sensible manner.
Last edit: 5 years 11 months ago by Andrew.

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

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago #172171 by Andrew
Replied by Andrew on topic K2 src and cache not writing
After looking at everything (including checking absolute paths to the server cache/log and testing), I’ve tried reinstalling K2 and downloaded Joomla, unzipped and copied over the files in case something is corrupt. Still no luck.

The image is entering the param (I can see it through the POST option) but it’s just not doing anything inside the K2 cache/src folders. I’ve updated to PHP 7.1. Frustratingly, everything else is working absolutely fine throughout the site.

Is there a particular trigger that starts the image creation in the k2 cache folder?

Thanks

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

More
5 years 11 months ago #172173 by JoomlaWorks
Replied by JoomlaWorks on topic K2 src and cache not writing
I'm thinking the upload library we use may not be compatible with IIS. What exact version of IIS are you using and on which Windows Server release?

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

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago #172205 by Andrew
Replied by Andrew on topic K2 src and cache not writing
Hi, thanks for getting back in touch. I think it’s IIS 10 and Server 2016. It was working pre-upgrade. I did update the server/IIS too though. In fact, K2 has been working impressively until now.

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

More
5 years 11 months ago #172211 by JoomlaWorks
Replied by JoomlaWorks on topic K2 src and cache not writing
The PHP library used for these uploads was upgraded a couple of times in recent releases, so that could be the issue. Otherwise, it may relate to the fact that you changed hosts and perhaps the setup is not identical. You need to turn error reporting to maximum and do a backend image upload. See what error appears there. If none is displayed, check the logs (the PHP error log will be different to Joomla's log).

If nothing works for you, I could have a look for you. Just use www.joomlaworks.net/support/contact to send me temporary super user access.

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

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago - 5 years 11 months ago #172224 by Andrew
Replied by Andrew on topic K2 src and cache not writing
Thanks. Part of the issue is that I keep getting a success message and therefore, no errors write to the logs. The K2 media section (and browse to server) work fine. Sadly, the thumbnail generation and multiple image sizes don’t trigger leaving the src and cache empty. I have full debugging turned on and developer level logging but no issue is being reported. I’m going to try a rebuild as a next step. I’m using GD2 (not GD) - would this cause any incompatibilities? I was also wondering if using paths with \\ (possible seeing the first \ as an escape?) may help solve the issue. I discounted this though due to attachments working properly.
Last edit: 5 years 11 months ago by Andrew.

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

More
5 years 11 months ago #172230 by JoomlaWorks
Replied by JoomlaWorks on topic K2 src and cache not writing
Actually, attachments also pass through the same library so it looks like uploads work. When you hit save, K2 will POST the data and then redirect to the items page or the item edit form itself. So it's difficult to see the message unless you locate the relevant function and do an "exit;" Look up your logs in case something is written there.

If not, let me know and I'll give you some guidance to troubleshoot further.

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

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago #172232 by Andrew
Replied by Andrew on topic K2 src and cache not writing
Thanks Fotis. All logs are clear. Any pointers about where to look will be helpful.

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

More
5 years 11 months ago #172242 by JoomlaWorks
Replied by JoomlaWorks on topic K2 src and cache not writing
Add a:
var_dump($handle);exit;

right after this line github.com/getk2/k2/blob/master/administrator/components/com_k2/models/item.php#L261

What's the output when you save a K2 item with an image added?

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

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago #172253 by Andrew
Replied by Andrew on topic K2 src and cache not writing
Thanks Fotis, I'll try this out tomorrow. I spent a bit of time dabbling this morning and added:

294 <?php var_dump($this->row->image);

to \joomla\myblog\administrator\components\com_k2\views\item\tmpl\default.php

Notice: Undefined property: TableK2Item::$image

and could see that the $this->row->image is not populating after a save. In items (pre-update of the Joomla/server) this path had the correct url path and cached image. I could see the var_dump correctly outputting the "https..." string.

I look forward to trying out your suggestion tomorrow and reviewing the output. On a side note, I have found K2 absolutely brilliant and appreciate your help with this.

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

More
5 years 11 months ago #172258 by JoomlaWorks
Replied by JoomlaWorks on topic K2 src and cache not writing
You're welcome.

For the record, the var_dump I provided will show whether the upload processing PHP class has issues with the first upload after saving the item form.

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

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago #172261 by Andrew
Replied by Andrew on topic K2 src and cache not writing
Perfect. I've fixed it. Thanks for the information Fotis, is was enough to give me a clear picture of the problem. It is an odd bug though but I have a fix and this will be helpful for anyone else using K2 on IIS experiencing the same problem.

Okay - so, the output for an upload attempt is as follows:

object(upload)#471 (139) { ["version"]=> string(7) "0.34dev" ["file_src_name"]=> string(23) "WednesdayPres1200x720.jpg" ["file_src_name_body"]=> string(19) "WednesdayPres1200x720" ["file_src_name_ext"]=> string(3) "jpg" ["file_src_mime"]=> string(10) "image/jpeg" ["file_src_size"]=> int(105360) ["file_src_error"]=> int(0) ["file_src_pathname"]=> string(105) "D:\joomla\myblog/images\articles\events\keydates\WednesdayPres1200x720.jpg" ["file_src_temp"]=> string(0) "" ["file_dst_path"]=> string(0) "" ["file_dst_name"]=> string(0) "" ["file_dst_name_body"]=> string(0) "" ["file_dst_name_ext"]=> string(0) "" ["file_dst_pathname"]=> string(0) "" ["image_src_x"]=> int(1200) ["image_src_y"]=> int(720) ["image_src_bits"]=> int(8) ["image_src_pixels"]=> int(864000) ["image_src_type"]=> string(3) "jpg" ["image_dst_x"]=> int(1200) ["image_dst_y"]=> int(720) ["image_dst_type"]=> string(0) "" ["image_supported"]=> array(9) { ["image/gif"]=> string(3) "gif" ["image/jpg"]=> string(3) "jpg" ["image/jpeg"]=> string(3) "jpg" ["image/pjpeg"]=> string(3) "jpg" ["image/png"]=> string(3) "png" ["image/x-png"]=> string(3) "png" ["image/bmp"]=> string(3) "bmp" ["image/x-ms-bmp"]=> string(3) "bmp" ["image/x-windows-bmp"]=> string(3) "bmp" } ["file_is_image"]=> bool(true) ["uploaded"]=> bool(true) ["no_upload_check"]=> bool(true) ["processed"]=> bool(false) ["error"]=> string(35) "File too big. : 105360 > -968884224" ["log"]=> string(2263) "system information
- class version : 0.34dev
- operating system : WINNT
- PHP version : 7.1.29
- GD version : 2.1.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 3172M (3326083072 bytes)
- language : en_GB
source is a local file D:\joomla\myblog/images\articles\events\keydates\WednesdayPres1200x720.jpg
- local file OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
MAGIC path defaults to C:\Program Files (x86)\PHP\v7.1/extras/magic
Fileinfo PECL extension failed (finfo_open)
- Checking MIME type with UNIX file() command
UNIX file() command not availabled
- Checking MIME type with mime.magic file (mime_content_type())
MIME type detected as image/jpeg by mime_content_type()
- MIME validated as image/jpeg
source variables
- You can use all these before calling process()
file_src_name : WednesdayPres1200x720.jpg
file_src_name_body : WednesdayPres1200x720
file_src_name_ext : jpg
file_src_pathname : D:\joomla\myblog/images\articles\events\keydates\WednesdayPres1200x720.jpg
file_src_mime : image/jpeg
file_src_size : 105360 (max= 3326083072)
file_src_error : 0
- source file is an image
image_src_x : 1200
image_src_y : 720
image_src_pixels : 864000
image_src_type : jpg
image_src_bits : 8
process file to D:\joomla\myblog/media/k2/items/src\
- error: File too big. : 105360 > -968884224

As you can see, there is something going on with the handing of the megabytes (M) to bytes converstion so for the fix? I used the bytes figure (3326083072) for my php.ini file and K2 is happy again.

Fotis - thanks for your help. You're support has been superb and I am pleased to be able to keep using K2. Out of interest - is this a K2 bug?

Thanks,

Andrew

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

More
5 years 11 months ago #172262 by JoomlaWorks
Replied by JoomlaWorks on topic K2 src and cache not writing
Windows never cease to amaze me... BTW, did you keep such a large upload limit?

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

  • Andrew
  • Andrew's Avatar Topic Author
  • Offline
  • New Member
More
5 years 11 months ago #172265 by Andrew
Replied by Andrew on topic K2 src and cache not writing
I know, it's quite a strange quirk! I'm just pleased that K2 is working well again since apart from this issue, it's been very strong and compatible with all templates I've used in the past.

I'm also hoping that this thread will help others solve their problems since it's quite a collection of troubleshooting steps and from my experience will be fine for anyone on the lastest Windows platform and version of PHP. I've checked the fix and it works on earlier versions of PHP and Windows server too.

Yes, it has a large upload limit due to the use of some rather large videos.

Judging by the PHP manual,

"When an integer is used, the value is measured in bytes", www.php.net/manual/en/ini.core.php#ini.post-max-size

so my number comes in at 3 gigbytes unless I've miscalculated.

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

More
5 years 11 months ago #172275 by JoomlaWorks
Replied by JoomlaWorks on topic K2 src and cache not writing
That's correct.

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


Powered by Kunena Forum