Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

imported images disappear in database :/

Go to End


Paweł Pierzchała

Community Member, 5 Posts

4 December 2008 at 5:53am

Edited: 04/12/2008 5:58am

i was supposed to import (from postgres db) some objects and images to SS. I did it and objects (hotels) work fine, but i have problem with images, they work fine till someone goes into 'Files and images' in CMS, after that records withy imported images in mysql database disappear.

I guess that i imported data and inserted them not to all required table.

What i did (in each step):
INSERT INTO File(ID,ClassName,Name,Title,Filename,ParentID,OwnerID) VALUES($actNumber,'Image','".$name1Got."','".$name1Got."','assets/".$rowP['photo1']."',8,1)

(at the end values 8 and 1, because i found out that cms automatically gives that values to that files)

UPDATE HotelSPA_Live SET Photo1ID = ".$actNumber." WHERE ID = ".$got['ID']."

UPDATE HotelSPA SET Photo1ID = ".$actNumber." WHERE ID = ".$got['ID']."

same thing for another 5 photos and then another step for another object

and as I said: works fine till somone goes into 'photo and files' in cms and (not sure that) when somone adds images in cms (from right menu).
I see that photos are loaded in cms (got option for delete or replace), but i don't see them, 'cause they're not in database (let's say objects had ID from 300 to 500, now new Id starts from 501)

What should I do to avoid that king of problem :)?