Media is not correctly being generated

Hi,

I just migrated a project I’m working on to Kirby 3.
Pretty much everything went really smooth. I’ve only got one issue:
The media files are not being properly generated.
It seems that the directory setup is being done correctly but the actual image files are missing.
The setup is running in a local environment with gulp-connect-php (https://www.npmjs.com/package/gulp-connect-php).
My local PHP version is PHP 7.1.19.

When I run the whole setup inside with MAMP everything works.

I got the same issue on a live server where I uploaded the project to test.

This is my custom folder setup:

…
'index'     => __DIR__,
'site'      => __DIR__ . '/project',
'snippets'  => __DIR__ . '/resources/snippets',
'templates' => __DIR__ . '/resources/templates',
'assets'    => __DIR__ . '/assets',
'avatars'   => __DIR__ . '/assets/avatars',
'cache'   => __DIR__ . '/cache'

Thanks and best
Arthur

I’m not familiar with the gulp-connect-setup, if it works similar to the built-in server, you probably have to power it up with Kirby’s router: https://getkirby.com/docs/guide/troubleshooting/installation#thumbs-not-generated-panel-not-working

Another thing: there is no avatar root anymore… User avatars are now stored in the user account folder.

Thanks so much! :slight_smile:
That worked. I could provide the router rightaway in the gulp task:

const gulp = require('gulp'),
    config = require('../config.js'),
    php = require('gulp-connect-php')
    
gulp.task('php', function() {
    if (config.settings.useCustomProxy) {
        console.log('Using custom proxy server..')
        return
    }
    console.log('Starting regular PHP server.')
    php.server({
        base: './',
        port: config.devServer.phpServerPort,
        router: 'kirbycore/router.php'
    })
})

And good to know regarding the avatar root!
I started by transferring all the stuff from my old site.php and it probably slipped through.

Any idea why it’s still not working on the live server?

What is your remote server environment? And what exactly is not working on the remote? Just the images missing while subpages and the Panel work as expected?

Nevermind, it was just an issue with the htaccess because I changed something and forgot to put it over.
Should probably take a break now… Long day :laughing:

Have a great evening!

1 Like

Hey there, maybe you could help me out …
I got the same directory structure as getkirby.com, meaing the bare minimum files reside in a folder called www, while all the rest lives one directory below, called my-project.

When telling gulp-connect where Kirby’s router.php file is (my-project/kirby), I get this error:

[Thu Feb 21 00:36:22 2019] PHP Warning:  include(/my-project/index.php): failed to open stream: No such file or directory in /my-project/kirby/router.php on line 12
[Thu Feb 21 00:36:22 2019] PHP Stack trace:
[Thu Feb 21 00:36:22 2019] PHP   1. {main}() /my-project/kirby/router.php:0

Although, when going without the aforementioned router option, everything’s just fine (panel is working, etc) but some media files are being generated, others not (which seems very random to me). This occurs on frontend and backend alike: some images are being cropped / resized correctly, and others just don’t. Trying to view an image in the backend results in this error message:

 The JSON response from the API could not be parsed. Please check your API connection.

I’m interested in getting things to work with PHP’s built-in server (and thusgulp-connect), too … It was part of the beauty of Kirby 2 - sadly, K3 raised the bar higher without need imho … maybe @texnixe can bring some light into this matter?

The built-in server never worked reliably, not even with Kirby 2 (content representations, for example, didn’t work with K2 as far as I remember).

The new setup with the media folder allows you to move the content folder out of the way, with only the media folder having to be publicly accessible.

@S1SYPHOS could you please post your structure, I’m not quite following…

My site structure:

/my-project
  - / kirby
  - /vendor
  - /www
    - /media
    - index.php
    -.htaccess
  - /content
  - /site
  - Gulpfile.js
  - (package.json, config files, etc)

My gulp task:

gulp.task('connect', function() {
  connect.server({
    base: 'www', // .. index.php lives here
    router: 'kirby/router.php' // as suggested above
  });
});

Here’s a link to the router option.

I remember endless discussion about AJAX loadmore cookbook not working locally when developing with lcoal PHP servers, that’s true …

Hey everyone,

if it helps I could put my current setup (Kirby 3) on Github for you to have a look.

1 Like

@arthurschiller That would be nice for others who come here with this issue :slightly_smiling_face:

full ack, that’d be helpful indeed

Hey there, I just checked this repository, but it seems to lack the router.php setup:

Anywhoozle, I’d be glad to have a look at your (hopefully working) setup - otherwise I’ll return to using docker-based (or even vagrant-based) solutions, since Valet for Linux just doesn’t do the trick for me.

Hi, yeah that’s the setup but still an old one for Kirby 2.
I used it for a project I did recently where I updated for Kirby 3 support.
It’s not yet uploaded though. Don’t think I have the time tonight but tomorrow could work.

1 Like

Alright, I found some time :wink:
Here is the updated repo:

Let me know if anything is unclear. Just tested the basic setup and it worked but I didn’t dug into every detail so no guarantees :wink:

Best
Arthur