Jump to content

Batch upload images & automatically create one page for each one


lucas
 Share

Recommended Posts

yes, would be pretty easy, but not sure what you mean about categories and tags; are those in a spreadsheet, or part of the filename?

mass upload of files and then import to pages could be done with a small utility module that could be run on the page after you save, if this is a functionality that needs to be performed on a regular basis;

foreach($page->images as $image) {
		
		$newImage = new Page();
		
			$newImage->template = 'image'; // or whatever the template is
			$newImage->parent = 'whereever_you_are_keeping_these';
			$newImage->title = 'some_title'; 

		$newImage->save(); 
		
		// Show message
		// if using in a module:
		$this->message("Image added: {$newImage->title}");

		//or if running the api:
		echo "Image added: {$newImage->title}";
		
	} // end foreach

if you don't need something that can be run anytime from the admin, then you could just use a CSV file with a folder of images

Link to comment
Share on other sites

@lucas: If I understand you right, you want to do this upload only once? If yes, you simply may use a custom installer script.

Please can you tell a bit on how you have setup things?

  • Your PW installation is an online installation?
  • The imagefiles are on your local computer actually, but if needed, you also have SSH or FTP access to the PW site?
  • Where have you stored the fieldinformations (categories, tags)? CSV, ImageMetadata, a DB?

Or do you have a local PW installation with the 1000 image pages and fields for cats, flags, etc and want to upload only those imagepages and not other parts form the local install?

Depending on your answers it will be very easy to build an importer script for you. :)

  • Like 1
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...