1

I have two assets sources, Slideshow and Products. I have six Image Transforms.

On the home page I'm using a structure channel to play a simple slideshow and I'm using 3 transforms and all is working fine.

This code works fine:

{{ entry.productPhotos.first().geturl() }}

But this code throws an error:

{{ entry.productPhotos.first().geturl('productSlide') }}

error message

If you go on my assets source path, the file is uploaded but the transform folder doesn't exist.

I tried clearing cache, deleting records in craft_assettransformindex, and most of the things suggested here, but with no luck. The weird thing is that the other Structure with the assets Slideshow works fine so it couldn't be something with the paths.

I'm using 'generateTransformsBeforePageLoad' => true, in my config/general.php file.

You can see on my phpMyAdmin screenshot that the filename is NULL in the table craft_assettransformindex but all the other transforms for the slideshow are there:

db row

  • Hi Dimitrios, welcome to Stack Exchange. Hope you don't mind, I cleaned up your post a little. Specifically, I rolled your comment and linked error into the original post, to make it easier for anyone else trying to troubleshoot this same problem. :) – Lindsey D Feb 17 '16 at 0:30
  • Thanks I couldn't add 2 images because of my reputation which limits me to 1 link per post. – Dimitrios Vogiatzis Feb 17 '16 at 0:53
  • It was obvious that it was a path problem. I changed the path from assets/photos/products/ to ../assets/photos/products/ and now it's working fine. But could someone explain me why do i needed the ../ since the other assets were working without it? Could it be something to do with the environmental variables? Cheers – Dimitrios Vogiatzis Feb 17 '16 at 1:01
  • Now I cannot upload images because the path is wrong.... – Dimitrios Vogiatzis Feb 17 '16 at 1:16
4

A long shot, but if it is indeed a path problem, this has seemed to help me keep my path(s) straight. I my config.php file, I'll set a parameter for environmentVariables like this:

...

'.dev' => array(
    'devMode' => true,
    'siteUrl' => 'http://mysite.dev/',
    'environmentVariables' => array(
        'basePath' => $_SERVER['DOCUMENT_ROOT'] . '/',
        'baseUrl' => 'http://mysite.dev/',
    )
)

...

Then when you are defining your asset sources, you can use this for "File System Path":

{basePath}assets/photos/products/

Then for URL try this:

/assets/photos/products

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.