Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter kamath

    (@kamath)

    Here is my tested solution:
    A new variable $time_gmt is necessary to differ between local time and UTC.

    In “class.add-from-server.php” I have made the following changes, especially in function “handle_import_file” (All line items relate to the original script):

    1. Replace lines 260-670 by:
      // Initially, Base it on the -current- time.
      		// $time = current_time( 'mysql', 1 );
      		$time = current_time( 'mysql' );
      		$time_gmt = current_time( 'mysql', 1 );
      		// Next, If it's post to base the upload off:
      		if ( 'post' == $import_date && $post_id > 0 ) {
      			$post = get_post( $post_id );
      			if ( $post && substr( $post->post_date_gmt, 0, 4 ) > 0 ) {
      				// $time = $post->post_date_gmt;
      				$time = $post->post_date;
      				$time_gmt = $post->post_date_gmt;	
      			}
      		} elseif ( 'file' == $import_date ) {
      			// $time = gmdate( 'Y-m-d H:i:s', @filemtime( $file ) );
      			$time = gmdate( 'Y-m-d H:i:s', @filemtime( $file ) );
      			$time_gmt = $time;
      		}
    2. Add $time_gmt = $time; at the end of lines 315 and 340.
    3. Replace lines 415-421 by:

      $post_date = $time;
      $post_date_gmt = $time_gmt;

    That´s it. I hope that it will work without any errors and perhaps these code snippets are part of one of the future versions.

    • This reply was modified 9 years, 8 months ago by kamath.
    • This reply was modified 9 years, 8 months ago by kamath.
    Thread Starter kamath

    (@kamath)

    That’s my approach:

    Replace in “class.add-from-server.php”

    1. Line 261:
      $time = current_time( 'mysql', 1 );

      through

      $time = current_time( 'mysql' );

    2. Line 265,266:
      if ( $post && substr( $post->post_date_gmt, 0, 4 ) > 0 ) {
      $time = $post->post_date_gmt;}

      through

      if ( $post && substr( $post->post_date, 0, 4 ) > 0 ) {
      $time = $post->post_date;}

    But this leads to:

    • post_date_gmt = post_date = local time
    • post_modified_gmt = post_modified = local time

    So there is no difference between local time and UTC.

    • This reply was modified 9 years, 8 months ago by kamath.
    Thread Starter kamath

    (@kamath)

    Thanks for your explanation. This sounds really complicated…

    Thread Starter kamath

    (@kamath)

    Hi Ben,

    thanks for your answer. I assumed that my project is easy to implement.
    Background: So far I have used Nextgen Gallery. There, thumbnails are created in a subfolder thumbs. But now I have discovered the beauty of Virtue gallery and I want to take this. What struck me in the FTP-view the folder structure due to the numerous thumbnails is pretty confusing. But maybe I have to live with it…

    Thread Starter kamath

    (@kamath)

    Hi Kevin,

    thanks for your answer.
    The “original” image image.jpg is stored in wp-content/uploads/2016 by default using WordPress´ uploader.
    All generated thumbnails – image-150x150.jpg, image-300x300.jpg and image-1024x1024.jpg shall be stored in wp-content/uploads/2016/thumbs.

    For example using a ftp-client you can differ between orignal image and thumbnail, just because there are stored in different folders.

    • This reply was modified 9 years, 8 months ago by kamath.
Viewing 5 replies - 1 through 5 (of 5 total)