Jump to content

u-nikos

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by u-nikos

  1. Glad to hear u guys like it! I've also pushed some little changes to GitHub: - Added auto-focus on login username and password fields. - Tweaked the alignment of the login box elements. - Changed TinyMCE skin to o2k7 silver variant. - Moved search element a bit more away from the logout button. - Made admin breadcrumb translatable. - Changed h2 font-size to px because of em's on container elements. - Added more space between PageList move text and cancel button.
  2. Hey all, I'm releasing a new admin theme called Elegance. I tried to keep the look and feel of ProcessWire, but with a modern clean and robust touch to it. Special thanks to nikola, soma and adamspruijt, because I've used components from their themes that I liked (hope u guys are okay with it ). GitHub: https://github.com/u...ganceAdminTheme Direct download link: https://github.com/u...hive/master.zip
  3. Ah the pixel coordinates were indeed not working correctly, the following code should fix that: if(strpos($this->cropping[0], '%') === false) $pointX = $gdWidth * ((int) $this->cropping[0] / $this->image['width']); else $pointX = $gdWidth * ((int) $this->cropping[0] / 100); if(strpos($this->cropping[1], '%') === false) $pointY = $gdHeight * ((int) $this->cropping[1] / $this->image['height']); else $pointY = $gdHeight * ((int) $this->cropping[1] / 100); Though if you want to specify a crop without resizing, it should be a different function in the Pageimage class or an extra option for the size function ("resize" => false or something?). I've created a GitHub repository for the FieldtypeFocusPoint module I'm developing. It's my first ProcessWire module so I hope I've done everything correctly. Maybe u guys can take a look at it? All suggestions are welcome https://github.com/u...FocusPointImage Usage: $page->image->sizeWithFocusPointCropping(704, 165);
  4. Yeah I've seen the Thumbnails module and I think it is great when u need to have full control over the crops. The module I'm developing works a little bit different: When a user uploads an image, they can (optionally) select the most important part of the image. They only need to do it once per image, and after that, all generated crops will make sure the selected part is visible in the crop. This saves time, because the user doesn't need to define (for example) 4 different crops per uploaded image. They just select the most important part of the image. And when you (as developer) need a new crop somewhere on the website, you wouldn't need to define a new crop for all existing images because it can be auto-generated according to the most important part. I hope this clarify's the difference.
  5. Thanks Ryan! I've started working on a module to select the most important part in a image (with a draggable crosshair) and it's almost finished. Though I didn't get the expected result because (like interrobang is mentioning) the current percentage cropping is not setting the center. The following code should fix that: // @interrobang + @u-nikos if (strpos($this->cropping[0], '%') === false) { $pointX = (int) $this->cropping[0]; } else { $pointX = $gdWidth * ((int) $this->cropping[0] / 100); } if (strpos($this->cropping[1], '%') === false) { $pointY = (int) $this->cropping[1]; } else { $pointY = $gdHeight * ((int) $this->cropping[1] / 100); } if ($pointX < $targetWidth / 2) { $w1 = 0; } else if ($pointX > ($gdWidth - $targetWidth / 2)) { $w1 = $gdWidth - $targetWidth; } else { $w1 = $pointX - $targetWidth / 2; } if ($pointY < $targetHeight / 2) { $h1 = 0; } else if ($pointY > ($gdHeight - $targetHeight / 2)) { $h1 = $gdHeight - $targetHeight; } else { $h1 = $pointY - $targetHeight / 2; } It seems like the module is working great with the above code
  6. Ok, I've now set the "upload_tmp_dir" to "/home/www.domain.com/_tmp" (only accessible by the www.domain.com user) instead of the default "/tmp" directory. Apparently SELinux does not relabel files when moving/renaming them between directories, only when creating/copying files. By using a tmp directory in the home directory, the uploaded files get a "user_home_t" label, which should be enough. Does anybody know any disadvantages of this method?
  7. Thanks for the quick responses! I have narrowed the problem down to SELinux. When a file is uploaded PHP stores the file in the /tmp directory and after that Upload.php moves the file with rename or move_uploaded_file to the final destination. The problem is that the file doesn't have the correct SELinux label after moving it. I dont have a solution yet but I'm working on it. Maybe someone else has encountered this problem before?
  8. Hey all, I'm having a weird issue. Uploaded files are not visible with SFTP. The files get uploaded to the correct directories with the correct permissions and owner settings but somehow they don't show up in SFTP sessions. All thumbnails are visible; it's just the uploaded file that is not visible. The files do show up when changing the following line: Upload.php line 233: if($ajax) $success = @rename($tmp_name, $destination); to: Upload.php line 233: if($ajax) $success = @copy($tmp_name, $destination); Anybody know what is going on?
  9. Or maybe it's better to use numbers between 0 and 100 for consistency with the quality percentage option? ImageSizer.php line 266: if (is_array($this->cropping)) { $w1 = ($gdWidth - $targetWidth) * ($this->cropping[0] / 100); $h1 = ($gdHeight - $targetHeight) * ($this->cropping[1] / 100); } ImageSizer.php line 533: else if(is_array($cropping)) $cropping = array(round(min(100, max(0, $cropping[0]))), round(min(100, max(0, $cropping[1])))); Pageimage.php line 198: // crop name if custom center point is specified if(is_array($crop)) $crop = 'c' . $crop[0] . '-' . $crop[1];
  10. Thanks for the input interrobang, your solution works perfectly Some code that is also needed: ImageSizer.php line 533: else if(is_array($cropping)) $cropping = array(round(min(1, max(0, $cropping[0])), 2), round(min(1, max(0, $cropping[1])), 2)); Pageimage.php line 198: // crop name if custom center point is specified if(is_array($crop)) $crop = 'c' . $crop[0] * 100 . '-' . $crop[1] * 100; This will generate filenames like: "avontuur.704x165c30-40.jpg"
  11. Hey Ryan, I saw your recent commits to the ImageSizer and was wondering if you could also add the ability to provide a custom center value (x, y) to the ImageSizer? Like: setCropping(array('30%', '40%')) or setCropping(array('200px', '300px')) Sometimes you know exactly what the most important part of a uploaded image is. And this could also come in handy when developing a InputFieldImage module where the user can click on a image in the page editor to define his own cropping center (or focus point). Most images have a certain point in a image that is most important (like a human face) and should always be visible in crops. Greetings, Niek
×
×
  • Create New...