Jump to content

ProcessWire Dev Branch


ryan

Recommended Posts

On github there is a commit called "Bump version number to 2.3.3" so if i checkout that commit that's ok, but what about all the other minor version steps? I can't find them.

I'd love to get 2.3.1 and 2.3.2 as well.

Dev branch versions aren't official versions, other than version "dev branch", so we don't keep separate downloads of them. The version numbers are primarily so that when we apply some big change, we have a way of being able to track it with bug change reports. 

Link to comment
Share on other sites

If I upload an image to an image filed on the EDIT page, the uploaded image does not show, I see the browser's "image broken link question mark" instead of the image preview. 

As soon as I publish that page, the image is visible. If I unpublish again, the image ink is broken again on the edit page. I suspect this to be a rights problem. A bug or a conflict with some module? (I mean: am I the only one having this?)

Link to comment
Share on other sites

Yes, I was just to report it when I saw that you identified it.

That is right, my setting:

$config->pagefileSecure = true;

If set to "false" (the default after a PW fresh install) the spook is gone and the image shows. So I have my fix now.

I find that behavior..hm....unexpeced... within the admin interface. It gives the false feedback to an editor that something's wrong with the image, although it's not.

Link to comment
Share on other sites

If set to "false" (the default after a PW fresh install) the spook is gone and the image shows. So I have my fix now.

I find that behavior..hm....unexpeced... within the admin interface. It gives the false feedback to an editor that something's wrong with the image, although it's not.

When $config->pagefileSecure is enabled, the images on unpublished an non-guest viewable pages are protected by the .htaccess file. However, if you are on the dev branch and using this option, you'll want to comment out these two lines from your .htaccess file. They are meant to be commented out by default, but looks like they aren't currently on the dev branch. Only use the $config->pagefileSecure option if it is worthwhile to your site, because it is a little slower to serve images/files this way. 

Link to comment
Share on other sites

When i try to install everything seems to be fine until i get the messages below. Then the installation halts and i don't get any error messages.

Database connection successful to xxx
Saved database configuration to ./site/config.php
The hosting provider couldn't see any errors in their logs. 
Link to comment
Share on other sites

Have not got time to debug atm but is also can't successfully install the latest dev. Seems that recent modifications to install.php breaks some stuff; installation hangs on database work, nothing written to db.

dev.jpg

Link to comment
Share on other sites

Same here, Sinnut & Mats.

Install looks like to quit while creating database tables.

Tried to import the SQL manually also didn't work. Quits after creating field_summary.

The weird thing is it looks like the (install) SQL isn't changed. 

@Mats: //side note for no errors:  on line 293 on the installer "error_reporting(0);"

ps, Manually install ./wire/core/install.sql, and the installer will continue.

Edited by Martijn Geerts
  • Like 1
Link to comment
Share on other sites

Looks like I broke the dev installer with yesterday's commit. Sorry about that. It was just an exception that needed to be caught–PDO throws an exception in a spot where mysqli doesn't, so didn't think to add one. And now realize I must have had PDO's exception mode turned off when I tested. This is now fixed. 

  • Like 4
Link to comment
Share on other sites

@Ryan: I have send a pull request for the imageSizer because Roope has found an issue and I have found one some too. Also I have added linearized gamma workflow to get better / brighter results. (more about gamma errors in picture scaling).
 
I have setup a local page for testing the results of different resizes with different options. Also a check if transparency with gif and png is respected. This will be useful with further testing :)( Screenshot )


 
EDIT: @Ryan, meanwhile I have rewritten the ___resize method and it seems to work very well with all kinds of image dimensions: http://nogajski.de/priv/postings/rearrangedImageSizer.html
 
should I commit this to the previous opened pull request?

I have three parts put into separate methods:

  • prepareImageLayer
  • writeIPTC
  • getCropDimensions

and thats the rewritten ___resize method:

    /**
     * Resize the image proportionally to the given width/height
     *
     * Note: Some code used in this method is adapted from code found in comments at php.net for the GD functions
     *
     * @param int $targetWidth Target width in pixels, or 0 for proportional to height
     * @param int $targetHeight Target height in pixels, or 0 for proportional to width. Optional-if not specified, 0 is assumed.
     * @return bool True if the resize was successful
      *
     * @todo this method has become too long and needs to be split into smaller dedicated parts
     *
     */
    public function ___resize($targetWidth, $targetHeight = 0) {

        $orientations = null; // @horst
        $needRotation = $this->autoRotation !== true ? false : ($this->checkOrientation($orientations) && (!empty($orientations[0]) || !empty($orientations[1])) ? true : false);

        $source = $this->filename;
        $dest = str_replace("." . $this->extension, "_tmp." . $this->extension, $source);
        $image = null;

        switch($this->imageType) { // @teppo
            case IMAGETYPE_GIF: $image = @imagecreatefromgif($source); break;
            case IMAGETYPE_PNG: $image = @imagecreatefrompng($source); break;
            case IMAGETYPE_JPEG: $image = @imagecreatefromjpeg($source); break;
        }

        if(!$image) return false;

        if($needRotation) { // @horst (Rotation is executed first because it can change width and height dimensions!)
            $image = $this->imRotate($image, $orientations[0]);
            if($orientations[0] == 90 || $orientations[0] == 270) {
                // we have to swap width & height now!
                $tmp = array($targetWidth, $targetHeight);
                $targetWidth = $tmp[1];
                $targetHeight = $tmp[0];
                $tmp = array($this->getWidth(), $this->getHeight());
                $this->setImageInfo($tmp[1], $tmp[0]);
            }
            if($orientations[1] > 0) {
                $image = $this->imFlip($image, ($orientations[1] == 2 ? true : false));
            }
        }

        // if we need to _scale_ an image we can get better results with first linearize the gamma curve
        // and convert back later, - after manipulations are finished -
        // but we cannot use it together with (transparent) PNG
        $linearizedGamma = false;

        // get all dimensions at first, before any image operation
        list($gdWidth, $gdHeight, $targetWidth, $targetHeight) = $this->getResizeDimensions($targetWidth, $targetHeight);
        $w1 = ($gdWidth / 2) - ($targetWidth / 2);
        $h1 = ($gdHeight / 2) - ($targetHeight / 2);
        $this->getCropDimensions($w1, $h1, $gdWidth, $targetWidth, $gdHeight, $targetHeight);

        // now lets check what operations are necessary:
        if($gdWidth==$targetWidth && $gdWidth==$this->image['width'] && $gdHeight==$this->image['height'] && $gdHeight==$targetHeight) {

            // this is the case if the original size is requested or a greater size but upscaling is set to false.
            // we only need one operation and without resampling, just copy!
            $thumb = imagecreatetruecolor($gdWidth, $gdHeight);
            $this->prepareImageLayer($thumb, $image);
            imagecopy($thumb, $image, 0, 0, 0, 0, $targetWidth, $targetHeight);
            $this->sharpening = 'none';  // no need for sharpening because we use original copy without scaling

        }
        elseif($gdWidth==$targetWidth && $gdHeight==$targetHeight) {

            // this is the case if we scale up or down without cropping
            // we need one operation with resampling.
            if($this->imageType != IMAGETYPE_PNG) {
                imagegammacorrect($image, 2.0, 1.0);  // linearize gamma to 1.0
                $linearizedGamma = true;
            }
            $thumb = imagecreatetruecolor($gdWidth, $gdHeight);
            $this->prepareImageLayer($thumb, $image);
            imagecopyresampled($thumb, $image, 0, 0, 0, 0, $gdWidth, $gdHeight, $this->image['width'], $this->image['height']);

        }
        else {

            // we use two steps if we scale up or down and also need to crop!
            if($this->imageType != IMAGETYPE_PNG) {
                imagegammacorrect($image, 2.0, 1.0);  // linearize gamma to 1.0
                $linearizedGamma = true;
            }
            $thumb2 = imagecreatetruecolor($gdWidth, $gdHeight);
            $this->prepareImageLayer($thumb2, $image);
            imagecopyresampled($thumb2, $image, 0, 0, 0, 0, $gdWidth, $gdHeight, $this->image['width'], $this->image['height']);

            $thumb = imagecreatetruecolor($targetWidth, $targetHeight);
            $this->prepareImageLayer($thumb, $image);
            imagecopyresampled($thumb, $thumb2, 0, 0, $w1, $h1, $targetWidth, $targetHeight, $targetWidth, $targetHeight);
            imagedestroy($thumb2);

        }

        if($this->sharpening && $this->sharpening != 'none') $thumb = $this->imSharpen($thumb, $this->sharpening); // @horst

        // write to file
        $result = false;
        switch($this->imageType) {
            case IMAGETYPE_GIF:
                if($linearizedGamma) {
                    imagegammacorrect($thumb, 1.0, 2.0);  // correct gamma from linearized 1.0 back to 2.0
                }
                $result = imagegif($thumb, $dest);
                break;
            case IMAGETYPE_PNG:
                // convert 1-100 (worst-best) scale to 0-9 (best-worst) scale for PNG
                $quality = round(abs(($this->quality - 100) / 11.111111));
                $result = imagepng($thumb, $dest, $quality);
                break;
            case IMAGETYPE_JPEG:
                if($linearizedGamma) {
                    imagegammacorrect($thumb, 1.0, 2.0);  // correct gamma from linearized 1.0 back to 2.0
                }
                $result = imagejpeg($thumb, $dest, $this->quality);
                break;
        }

        @imagedestroy($image);
        @imagedestroy($thumb);

        if($result === false) {
            if(is_file($dest)) @unlink($dest);
            return false;
        }

        unlink($source);
        rename($dest, $source);

        $this->writeIPTC();  // @horst: if we've retrieved IPTC-Metadata from sourcefile, we write it back now

        $this->loadImageInfo($this->filename);
        $this->modified = true;

        return true;
    }
  • Like 1
Link to comment
Share on other sites

@Ryan: I have send a pull request for the imageSizer because Roope has found an issue and I have found one some too. Also I have added linearized gamma workflow to get better / brighter results. (more about gamma errors in picture scaling).

Thanks Horst! Your knowledge and code for working with images is fantastic! I will pull this into dev soon. I need to get caught up with my forum messages, and then hoping to catch up with my GitHub messages next week. 

should I commit this to the previous opened pull request?

Separate PR is fine. For stuff like this, I generally make sure I understand everything that gets committed by re-typing the lines myself or at least going through them individually on a copy/paste, until I understand it in full. It takes longer to do this way, but it ensures I can properly support it in the future if a question comes up and you are on vacation. :) 

  • Like 2
Link to comment
Share on other sites

EDIT: complete file is here

-----------------------------------------------------------------------------------------------

Ryan,

I cannot create a second PR at GitHub, so I add the rewritten code as zip attachment here.

And it is really good that you will understand it in full after merged it. Because, also if I'm not on vacation (lets say 6, 7 months ago) I'm not sure if I will remember right all the things. ;)

So, I have added few more comments to it. :)

BTW, these page about gamma errors is awesome. I have done the test with my Photoshop CS6 Extended localized german for nearly 2k € (if not an upgrade) - and it fails completly with 8bit images. I only get the grayish result with some colored blurriness like in the examples of the site.

The short story is: try to scale this prepared image gamma_dalai_lama_gray.jpg at 50% with whatever software you want.

How does your result look? Like this one: gamma_dalai_lama_gray_scaled.jpg or like this one: gamma_dalai_lama_gray_good.jpg

If you want to know why and how, pleas look here: http://www.4p8.com/eric.brasseur/gamma.html#introduction

Edited by horst
  • Like 2
Link to comment
Share on other sites

@Ryan

would make sense to include translation strings in the ProcessLanguage.module (\wire\modules\LanguageSupport\ProcessLanguage.module)

 'title' => __('Languages', __FILE__),
 'summary' => __('Manage system languages', __FILE__),

so we get an consistent translation under 'Setup'.

BTW: is it ok to post such things here? Or better doing this via GitHub?

  • Like 1
Link to comment
Share on other sites

BTW: is it ok to post such things here? Or better doing this via GitHub?

I would say both if you can. Things can easily go astray in the forums. If you file an issue in Github it is easy to remember it and track its progress. In the Github issue, you can also make reference to your post, for posterity, etc.  :)

  • Like 1
Link to comment
Share on other sites

Little update on dev branch: The default admin theme now comes with an autocomplete search. If you are superuser, it will include templates, fields and users in the search as well. Once 2.4 goes stable, I'll assist with implementing this in other admin themes too. 

post-2-0-63983900-1378906536_thumb.png

  • Like 19
Link to comment
Share on other sites

hmm, no one replied to the question there... so I post it here. Some possible translation updates:

/wire/templates-admin/default.php (for complete main menu and heading translations)

/*
 * Dynamic phrases that we want to be automatically translated
 *
 * These are in a comment so that they register with the parser, in place of the dynamic __() function calls with page titles. 
 * 
 * __("Pages"); 
 * __("Setup"); 
 * __("Modules"); 
 * __("Access"); 
 * __("Admin"); 
 * __("Languages");   // add
 * __("Users");       // add
 * __("Roles");       // add
 * __("Permissions"); // add
 * 
 */

/wire/modules/LanguageSupport/ProcessLanguage.module (translatable 'Edit' and 'Translate new File' link)

$lastMod = date($this->config->dateFormat, filemtime($pagefile->filename)); 
$edit = __('Edit', __FILE__); // add

$out = 	"<div class='InputfieldFileLanguageInfo'>" . 
	"<ul class='actions'>" . 
	"<li><a href='{$translationUrl}edit/?language_id={$page->id}&textdomain=$textdomain'>$edit</a></li>" .  // change
	"</ul>" . 
	"<p><span class='InputfieldFileLanguageFilename'>/$file —</span> <span class='notes'>$message</span></p>" . 
	"</div>";
$translationUrl = $this->translationUrl();
$page = $event->arguments[0]->get('page');
$translate = __('Translate New File', __FILE__); // add

$out =	"<ul class='actions LanguageFilesActions'>" . 
	"<li><a href='{$translationUrl}add/?language_id={$page->id}'>$translate</a></li>" .  // change
	"</ul>";
  • Like 4
Link to comment
Share on other sites

 * __("Languages");   // add
 * __("Users");       // add
 * __("Roles");       // add
 * __("Permissions"); // add
 * 

Those above are actually translated with the individual modules (ProcessUser, ProcessRole, ProcessPermission), though looks like I didn't yet it have it translatable for ProcessLanguage. Though there's no harm in having them translatable there too, but just not sure it's necessary. 

/wire/modules/LanguageSupport/ProcessLanguage.module (translatable 'Edit' and 'Translate new File' link)

Good catch–thanks, I have added this and they'll be on dev shortly. 

Link to comment
Share on other sites

Thanks for the updates Manfred62. Timeline to release is whenever the dev source can sit for a few days without needing any bug fixes or updates to it. We were getting close, but I've lately been adding more to it, so not yet sure on a release date. But I would like to do a lockdown for additions pretty soon, so that we are only updating for bug fixes, and that should present a release date soon after. 

Link to comment
Share on other sites

1. found something strange when working with translations (PW 2.3.4):

when changing/deleting something in the files, in Language Translator you get the 'abandoned translations' field. Now it's not possible to delete this (checkbox 'delete', then save). Can only delete directly in the language-file. My mistake or a bug?

2. under Access-User-username: the block 'Roles' is not translatable?

    under Access-Roles-username: the heading of block 'Permissions' is not translatable?

had done a search over all files and found these strings in the \wire\core\install.sql

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
  • Recently Browsing   0 members

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