- Posts: 9
COMMUNITY FORUM
K2 src and cache not writing
- Andrew
-
Topic Author
- Offline
- New Member
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?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Please Log in or Create an account to join the conversation.
- Andrew
-
Topic Author
- Offline
- New Member
- Posts: 9
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.
Please Log in or Create an account to join the conversation.
- Andrew
-
Topic Author
- Offline
- New Member
- Posts: 9
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.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Please Log in or Create an account to join the conversation.
- Andrew
-
Topic Author
- Offline
- New Member
- Posts: 9
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
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
-
Topic Author
- Offline
- New Member
- Posts: 9
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
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
-
Topic Author
- Offline
- New Member
- Posts: 9
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
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
-
Topic Author
- Offline
- New Member
- Posts: 9
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.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
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
-
Topic Author
- Offline
- New Member
- Posts: 9
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.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Please Log in or Create an account to join the conversation.
- Andrew
-
Topic Author
- Offline
- New Member
- Posts: 9
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.
- JoomlaWorks
-
- Offline
- Admin
- Posts: 6227
Please Log in or Create an account to join the conversation.