[dev] [commit] r987 - patches phplib/models wwwbase/admin wwwbase/js

Cătălin Frâncu cata at francu.com
Wed Sep 18 19:56:06 EEST 2013


Perfect!
Cătălin

On 2013-09-17 03:15, automailer at dexonline.ro wrote:
> Author: grigoroiualex
> Date: Tue Sep 17 13:15:31 2013
> New Revision: 987
> 
> Log:
> Added image size to Visual table (columns width and height) as it is
> needed in the presentation part when large images are scaled.
> Moreover, tags coordinates are saved at the image true size, thus they
> will be scaled as well, hence the need of these fields.
> 
> Added:
>    patches/00100.sql
> Modified:
>    phplib/models/Visual.php
>    wwwbase/admin/visualTag.php
>    wwwbase/js/visualTag.js
> 
> Added: patches/00100.sql
> ==============================================================================
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ patches/00100.sql	Tue Sep 17 13:15:31 2013	(r987)
> @@ -0,0 +1,2 @@
> +ALTER TABLE Visual ADD width INT(11) AFTER path;
> +ALTER TABLE Visual ADD height INT(11) AFTER path;
> 
> Modified: phplib/models/Visual.php
> ==============================================================================
> --- phplib/models/Visual.php	Mon Sep 16 20:32:25 2013	(r986)
> +++ phplib/models/Visual.php	Tue Sep 17 13:15:31 2013	(r987)
> @@ -51,6 +51,15 @@
> 
>    /** Extended by creating uploaded image thumbnail */
>    function save() {
> +    $path = util_getRootPath() . 'wwwbase/img/' . $this->path;
> +
> +    // Saves the image size for further use when scale is needed
> +    if(!$this->width || !$this->height) {
> +      $dim = getimagesize($path);
> +      $this->width = $dim[0];
> +      $this->height = $dim[1];
> +    }
> +
>      // Make a directory into which to generate or copy the thumbnail
>      @mkdir($this->getThumbDir(), 0777);
> 
> @@ -59,7 +68,7 @@
> 
>      // Generate thumbnails for uploads or copy-pastes
>      if (!$original) {
> -      $thumb = new Imagick(util_getRootPath() . 'wwwbase/img/' . 
> $this->path);
> +      $thumb = new Imagick($path);
>        $thumb->thumbnailImage(0, self::$thumbSize);
>        $thumb->sharpenImage(1, 1);
>        $thumb->writeImage($this->getThumbPath());
> 
> Modified: wwwbase/admin/visualTag.php
> ==============================================================================
> --- wwwbase/admin/visualTag.php	Mon Sep 16 20:32:25 2013	(r986)
> +++ wwwbase/admin/visualTag.php	Tue Sep 17 13:15:31 2013	(r987)
> @@ -18,7 +18,6 @@
>    $yTag = util_getRequestParameter('yTag');
>    $xImg = util_getRequestParameter('xImg');
>    $yImg = util_getRequestParameter('yImg');
> -  $isMain = util_getRequestParameter('isMain');
> 
>    $line = Model::factory('VisualTag')->create();
>    $line->imageId = $imageId;
> 
> Modified: wwwbase/js/visualTag.js
> ==============================================================================
> --- wwwbase/js/visualTag.js	Mon Sep 16 20:32:25 2013	(r986)
> +++ wwwbase/js/visualTag.js	Tue Sep 17 13:15:31 2013	(r987)
> @@ -17,7 +17,7 @@
>      });
>    };
> 
> -  //Shows centre of the selection coordinates
> +  /** Shows centre of the selection coordinates */
>    function showCoords(c) {
>      setCoords(c);
> 
> @@ -42,7 +42,7 @@
>      return centre;
>    };
> 
> -  //Clears the actual selection
> +  /** Clears the actual selection */
>    $('#clrSel').click(function(e) {
>      jcrop_api.release();
> 
> @@ -79,6 +79,9 @@
>      var id = $(this).select2('data').id;
>      var text = $(this).select2('data').text;
> 
> +    // Matches only the lexeme, without the description in brackets
> +    text = text.match(/^[^ \(]+/);
> +
>      $('#lexemeId').val(id);
>      $('#lexeme').val(text);
>    });
> _______________________________________________
> Dev mailing list
> Dev at dexonline.ro
> http://list.dexonline.ro/listinfo/dev


More information about the Dev mailing list