This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

freeyland10761
freeyland10761

I would like to import files in bulk from another system. The problem is that the files are stored in a location based on a hash key in the field disk_name.

I think this is the code responsible to create the hash:

 public static function getUniqueCode($file)
    {
        if (!$file) {
            return null;
        }

        $hash = md5($file->file_name . '!' . $file->disk_name);
        return base64_encode($file->id . '!' . $hash);
    }

Is it possible to have the same function in mysql. I found md5 is available and I found a function to have base64_encode availe inside mysql. What is the original $file->disk_name value

Last updated

mjauvin
mjauvin

Can you give a bit more details on where you want to import from and why you would need the mysql md5/base64_encode functions?

freeyland10761
freeyland10761

Hi Mjauvin, I reveived a table with images linked to hotels from wordpress. I've created a new module (hotelmanager) in October and would like to import the images into october cms system_files table. I've already imported the hotels from wordpress but I also need to link the images.

thnx

mjauvin
mjauvin

I would use the Import Export behavior for this.

ref. https://octobercms.com/docs/backend/import-export

How many images are we talking about?

freeyland10761
freeyland10761

About 3500 hotels X 3 images.

mjauvin
mjauvin

If you can get/build a CSV of image name / hotel id and have all the images in a local folder, should be easy with an Import model as I referenced in my previous post.

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.