Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Instant Website: Realty/Listings/Auto:
How to use images uploaded via FTP

 

 


Pixels & Beats
User

Dec 2, 2009, 4:02 AM

Post #1 of 4 (4260 views)
Shortcut
How to use images uploaded via FTP Can't Post

Hello again :)

I am using CMSB with the Auto template to work with data supplied by a third party. The data is not entered in the normal way, and is actually uploaded via FTP each night, as are the associated images. A script then imports the data into the database the CMSB connects to. The table structure is different to that of the standard Auto template.

All aspects of the data work fine in CMSB, however there is one problem I am not sure how to approach and would very much appreciate your advice.

The images for each product are uploaded via FTP to a subdirectory. The file names for the images are imported into the database in the following manner:

Field: IMAGENAMES
(Field content): image01.jpg,image02.jpg

I have setup the database so that there is path information as to where the images are located:

Field: IMAGEPATH
(Field content): D:/Hosting/4443434/html/usedbikes/data/

So the problem I face is how to get the images to show.

Is it worth trying to inject the image data into the _uploads part of the database? I have investigated this process and understand the 'num' relationship between the records. However the issue of thumbnail creation would also need to be addressed (I will probably generate them on the fly using JavaScript).

I am not a PHP or MySQL programmer and everything I do is learnt on the fly and with LOTS of trial and error. I have got this far and everything else works great. This is my last major hurdle.... Hope you experts can help!

Kind regards

8BG


(This post was edited by 8bit Gamer on Dec 2, 2009, 5:43 AM)


Pixels & Beats
User

Dec 3, 2009, 8:41 AM

Post #2 of 4 (4234 views)
Shortcut
Re: [8bit Gamer] How to use images uploaded via FTP [In reply to] Can't Post

Well I've nearly worked out how to do it by putting myself on a internet search 1 day crash course on SQL stuff!!

The only problem I have now is how to split or at least work with the image names which are in one field but separated by columns. My current SQL code looks like this and may be of use to others trying to work with CMSB in a non conventional way:


# Clear table of rows, but leaves columns intact
TRUNCATE TABLE usedbikes_uploads;

# Copies data from one table to another
INSERT INTO usedbikes_uploads
(filePath,info1,info2,info3,recordNum) SELECT PICTURE_REFERENCE,MAKE,MODEL,REGNUMBER,num FROM usedbikes_adverts;

# Inserts data into selected columns
UPDATE usedbikes_uploads
SET tableName='adverts', fieldName='uploads', width=600, height=450;

# Appends data into selected column
UPDATE usedbikes_uploads
SET filePath=concat('D:/Hosting/4443434/html/usedbikes/data/', filePath);


Damon
Staff / Moderator


Dec 3, 2009, 1:09 PM

Post #3 of 4 (4226 views)
Shortcut
Re: [8bit Gamer] How to use images uploaded via FTP [In reply to] Can't Post

Hi,

One thing you could try is editting the database as a text file. When I move CMS Builder from one host to another, and the uploads file path changes, I find it is easiest to open the database in a text editor and search and replace the path as needed.

I use the Database Backup feature in Admin > General Settings. After I backup the database, I download it via FTP and open it in a text editor. After making changes, I upload it back to the same directory (/data/backups/) and go back to Admin > General Settings in CMS Builder to restore my updated database.

Which ever method is use, make sure to keep backups of the database which you can use to restore if things get messed up.

Hope that helps.

--------------------------------------------------- 
Cheers
Damon Edis
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/


Pixels & Beats
User

Dec 7, 2009, 2:29 AM

Post #4 of 4 (4144 views)
Shortcut
Re: [Damon] How to use images uploaded via FTP [In reply to] Can't Post

Hi Damon,

Thanks for the advice, however the database file is imported each night and contains new data, so the prospect of editing over 100 entries each which 3 to 6 images, makes me feel ill Crazy lol

I have it nearly working now, except the way the data is presented is a mess and the people who supply it will not change the format.

I will start a new post to see if I can solve the problem from a different angle......

8BG