Jump to content

Problem with regenerate thumbnails PS. 1.7


Andrejkov

Recommended Posts

Hello,

I have problem with regenerate thumbnails on my shop(PS 1.7.8). When i go to Design -> Image Settings -> regenerate thumbnails, I got error:

"Cannot write "No picture" image to products images folder. Please check the folder's writing permissions."

I tryed to change img/p/ permissions to chmod 777, but i have still this error. What i can do to fix it?

Regards.

Link to comment
Share on other sites

Of course, you can also run your own script to change permissions for folders and subfolders in ./img/p/.
Just insert this script into the root of the eshop and call it in the URL.
For example, the file will be named img-permission.php
So you run it, for example, https://my-shop.com/img-permission.php

<?php
    include('./config/config.inc.php');
    include('./init.php');
    
    $files = false; /* change permission on all files in dir "Demanding on script runtime" */
    $time_start = microtime(true); 

    for($ii = 1; $ii <= 9; $ii++){
        $path = _PS_PROD_IMG_DIR_.$ii;
        changeDirPermission($path, $files);

        for($jj = 0; $jj <= 9; $jj++)
        {
            $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj;
            changeDirPermission($path, $files);

            for($kk = 0; $kk <= 9; $kk++)
            {
                $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk;
                changeDirPermission($path, $files);

                for($ll = 0; $ll <= 9; $ll++)
                {
                    $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll;
                    changeDirPermission($path, $files);
                        
                    for($mm = 0; $mm <= 9; $mm++)
                    {
                        $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll.'/'.$mm;
                        changeDirPermission($path, $files);
                            
                        for($nn = 0; $nn <= 9; $nn++)
                        {
                            $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll.'/'.$mm.'/'.$nn;
                            changeDirPermission($path, $files);
                        }
                    }
                }
            }
        }
    }

    $time_end = microtime(true);

    $execution_time = ($time_end - $time_start);

    echo '<b>Total Execution Time:</b> '.round($execution_time, 2).' second';
   
    function changeDirPermission($path, $files) /* It should not be longer than 60 seconds */
    {
        if (file_exists($path)){
            chmod($path, 0755);
            if ($files == true){
                changeFilesPermission($path);
            }
        }
    } 

    function changeFilesPermission($path)
    {
        if (file_exists($path)){
            $files = scandir($path);
            if ($files){
                foreach ($files as $file){
                    chmod($file, 0644);
                }
            }
        }
    }

 

Edited by prestashopfree.com (see edit history)
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...