Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Imagizer
#51
(2014-11-25, 04:56:02)Carlos Wrote:
(2014-10-31, 22:11:40)Timbow Wrote: Love this plugin. Always use it.

Recently I needed to exclude an image from resizing, eg I wanted to link to a massive hi res image. I had to ftp it to another location and manually edit the link. Not a big issue I know but I presume it would be easy to exclude resizing from a folder of a given name, so say data/uploads/fullsize can have full size images.

A quick patch, for version 1.0

Edit Imagizer.php, find this (line 26):
Code:
function imagizer_handle(){

Just after that (in line 27), insert this:
Code:
if (defined('IMAGIZEREXCLUDE') && isset($_POST['path']) && (trim($_POST['path'],'/') == trim(IMAGIZEREXCLUDE,'/'))) return;

And now in gsconfig.php you can specify the subfolder (relative to data/uploads) you want to exclude from resizing, like this:
Code:
define('IMAGIZEREXCLUDE','fullsize');

Thanks for the idea. Probably will made another option in settings - fullsized-image folder.
Reply
#52
(2014-11-25, 04:56:02)Carlos Wrote: And now in gsconfig.php you can specify the subfolder (relative to data/uploads) you want to exclude from resizing, like this:
Code:
define('IMAGIZEREXCLUDE','fullsize');

Beautiful solution, this would have come in handy on quite a few projects. Is there any chance the plugin and instructions will be updated on Extend to reflect this new feature?
Reply
#53
@Carlos, thx for your solution. Was in need of that. Hope the plugin will be updated with this.
Reply
#54
I've updated Imagizer to version 1.1.
Changelog:
* Minor i18n bugfix.
* Exclude folder option added.
The exclude folder may be defined in 2 ways: using
PHP Code:
define('IMAGIZEREXCLUDE','fullsize'); 
in gsconfig.php (thanks to @Carlos) or by filling input in Advanced section. Imagizer will check for excluded string value occurrence in full upload path.
Thanks every one for using Imagizer and all your support and feedback!
Reply
#55
Hello,
I installed Imagizer on my localhost to test on GSCMS, and it is not working with files of an approximate size of 2.8M.

I have the following error :
Error : the file could not be uploaded.

My configuration is the following : GS CMS 3.3.4
line GSNOUPLOADIFIY uncommented in the gsconfig.php file
Chmod 777 on the imagizer folder in the plugins
chmod 666 on the config.xml file in the imagizer folder.

Do you know what could be the cause of this error ? I tried to enter the debug mode, but could not find anywhere the logs corresponding to my error.

I am new to GS CMS.

Thank you very much,
Andréa
Reply
#56
(2015-01-14, 20:10:06)AndreaP Wrote: Hello,
I installed Imagizer on my localhost to test on GSCMS, and it is not working with files of an approximate size of 2.8M.

I have the following error :
Error : the file could not be uploaded.

My configuration is the following : GS CMS 3.3.4
line GSNOUPLOADIFIY uncommented in the gsconfig.php file
Chmod 777 on the imagizer folder in the plugins
chmod 666 on the config.xml file in the imagizer folder.

Do you know what could be the cause of this error ? I tried to enter the debug mode, but could not find anywhere the logs corresponding to my error.

I am new to GS CMS.

Thank you very much,
Andréa

Hi,
First, GSNOUPLOADIFIY option needs to be uncommented only with GS 3.0, so you can comment this line in your 3.3.4 to use uploadify flash plugin.
Second, try uploading other images, non-image file (a .pdf for example) with Imagizer enabled and Imagizer disabled (you can enable/disable it in plugins section). If you cannot upload any file, then it's not Imagizer's fault.
Third, try uploading smaller images. If this succeeds, try to increase upload limit.
Fourth, check php and server (apache, nginx) logs for any warnings/errors/notices.
Hope, some of this will help.
Reply
#57
Hello,
thank you very much for your answer.

With files smaller than 2MB (the upload limit) it works.
I thought that imagizer would resize the images before the upload so they fit the size set in the settings ?
So my client (in the future) would not have to care about the file size ?

Thank you agin
Reply
#58
(2015-01-16, 06:19:09)AndreaP Wrote: I thought that imagizer would resize the images before the upload so they fit the size set in the settings ?

No, Imagizer is triggered after file has been uploaded to your server and moved to the uploads folder.

(2015-01-16, 06:19:09)AndreaP Wrote: So my client (in the future) would not have to care about the file size ?

He will not with Imagizer enabled. However you must increase the limit, because your uploads are rejected by http-server itself and don't reach php script which receives, handles and resizes them.
Reply
#59
Hello,

the Imagizer ain't working on my installation, the files have the same size as uploaded,
There's no error message or anything else.
Folder permissions are set as mentioned above.
No errors in errorlog and debug console stays silent.
I'm using Uploadify, cause the flash doesn't work.

I tried it on a different GS installation and it works there (also Uploadify).
Tried to disable all the plugins, no change.

That really is driving me nuts.
What may be the problem?

Edit: Ok, found the problem, the filename was *.JPG and that didn't work in that installation.
Changing the name to *.jpg made it work.
However, it worked on the other installation with the same picture, without flaw and with JPG being Uppercase.

What may cause this problem?
I'd be glad to have a chance and get rid of that strange behaviour.
Thanks in advance.
Shasaar
Reply
#60
Hello,

guess nobody got an idea so far? Hm.
What I noticed so far, after file has been uploaded:

GetSimple Installation A (No I18N plugins), Imagizer works:
File PGD.JPG has been saved as pgd.jpg

GetSimple Installation B (I18N, Special Pages, Search, etc.), Imagizer doesn't work:
File PGD.JPG has been saved as pgd.JPG

How could I be able to find out, which plugin changed the original way of uploading and changing the filenames?

Thanks in advance.
Cheers.
Shasaar
Reply
#61
Hi Shasaar,

I think, it's not the right approach, modifying the original image file size after the upload (unless desired by the client). For me there is absolutely no point in resizing the image if the original file is already on the server. The image should be resized before upload (in the Browser) https://gist.github.com/dcollien/312bce1270a5f511bf4a, or just after the upload during/before the output on the website. But that is just a personal opinion.

Besides, the plugin works very well for me, also with all those plugins (except "Search") you have mentioned, so the issue is somewhere else.
Reply
#62
Hello Bigin,

thank you for your reply.
I tried to find the step in Imagizer that "breaks", but I wasn't successful so far.
The name will be fetched by Imagizer in the right way (with *.JPG) but then I lost the trail.

Unfortunately, I'm not a programmer and all I know are the very, very few basics (like if, else and loops Big Grin).
That's why I also have no idea how to implement your snippet with the file resize in browser, but thank you for mentioning it Smile.

Have a nice sunday.
Cheers.
Shasaar
Reply
#63
Hello,

I've set the setting to exact size, landscape orientated.
When uploading a jpg-picture now that is portrait orientated, it gets a black background on both sides.
Unfortunately, the black background doesn't fit to the design of the page and I'd like to change the background to another color.
However, I wasn't successful.
Could somebody give me a hint please, why it's not working?
I've added the following lines to ImagizerImage.php:

PHP Code:
   public function resize($width,$height) {
 
       $new_image imagecreatetruecolor($width$height);
 
       $white imagecolorallocate($new_image 255255255);//added
 
       imagefilledrectangle($new_image00$width$height$white); //added
 
       imagealphablending($new_imagefalse);
 
       imagesavealpha($new_imagetrue);
 
       imagecopyresampled($new_image$this->_image0000$width$height$this->getWidth(), $this->getHeight());
 
       $this->_image $new_image;
 
       $this->_height=imagesy($this->_image);
 
       $this->_width=imagesx($this->_image);
 
       
    
    public 
function cropCenter($w,$h){
 
       $new_image imagecreatetruecolor($w$h);
 
      $white imagecolorallocate($new_image 255255255);//added
 
       imagefilledrectangle($new_image00$w$h$white);//added
 
       imagealphablending($new_imagefalse);
 
       imagesavealpha($new_imagetrue);
 
       $delta_w=abs($w-$this->getWidth());
 
       $delta_h=abs($h-$this->getHeight()); 

However, the extended area of the resized picture stays black Sad.

Thank you very much in advance.
Cheers.
Shasaar


Attached Files Thumbnail(s)
   
Reply
#64
(2017-08-13, 17:40:09)Shasaar Wrote: Hello Bigin,

thank you for your reply.
I tried to find the step in Imagizer that "breaks", but I wasn't successful so far.
The name will be fetched by Imagizer in the right way (with *.JPG) but then I lost the trail.

Unfortunately, I'm not a programmer and all I know are the very, very few basics (like if, else and loops Big Grin).
That's why I also have no idea how to implement your snippet with the file resize in browser, but thank you for mentioning it Smile.

Have a nice sunday.
Cheers.
Shasaar

Alright, in case somebody is facing the same problem one day, here is a solution:
Add the following to upload.php of GS core files:
line 52: $extension = strtolower($extension);

The reason I had to find the solution was, that the customer was quite disappointed that he had to rename the files from his camera (which saves the pictures in *.JPG) before uploading and even tho he was really eager trying, he forgot every now and then.

Problem solved, case closed, let's face another one, next one is just around the corner Wink.
Cheers.
Shasaar
Reply
#65
(2017-08-27, 19:52:42)Shasaar Wrote: I've set the setting to exact size, landscape orientated.
When uploading a jpg-picture now that is portrait orientated, it gets a black background on both sides.

Try using the 'Variable size' instead.

Select 'Variable size'
Minimum height & width: 0
Maximum height & width: 1000 (or whatever)
Priority: 'Maximum'

It will reduce files larger than the maximum, keeping the aspect ratio, so the canvas is the same size as the picture (so no background to fill).

(2017-08-27, 19:52:42)Shasaar Wrote:
PHP Code:
   public function resize($width,$height) {
 
       $new_image imagecreatetruecolor($width$height);
 
       $white imagecolorallocate($new_image 255255255);//added
 
       imagefilledrectangle($new_image00$width$height$white); //added
 
       imagealphablending($new_imagefalse);
 
       imagesavealpha($new_imagetrue);
 
       imagecopyresampled($new_image$this->_image0000$width$height$this->getWidth(), $this->getHeight());
 
       $this->_image $new_image;
 
       $this->_height=imagesy($this->_image);
 
       $this->_width=imagesx($this->_image);
 
       ... 

Try using php imagefill instead of imagefilledrectangle? See this Stackoverflow question.
--
Nick.
Reply
#66
(2017-09-01, 05:47:26)Shasaar Wrote: Alright, in case somebody is facing the same problem one day, here is a solution:
Add the following to upload.php of GS core files:
line 52: $extension = strtolower($extension);

For me, this only works if Uploadify is disabled. Can you try it?
--
Nick.
Reply
#67
The corresponding fix for use with uploadify enabled is in admin/upload-uploadify.php, line 35:
Code:
original:
$targetFile =  str_replace('//','/',$targetPath) . $name . '.'.$extension;

change to:
$targetFile =  str_replace('//','/',$targetPath) . $name . '.'.strtolower($extension);
Remember that editing core files is not recommended and changes will be lost when updating GS to a newer version.
--
Nick.
Reply
#68
(2017-09-02, 00:56:26)hameau Wrote: Remember that editing core files is not recommended and changes will be lost when updating GS to a newer version.

Hello Nick,

thank you for your message.

Of course, you are right and I wish I could avoid GS-core & also plugin core changes but sometimes, it seems like there's no other choice.

My GS-config is set to:
Quote:# Use Uploadify to upload files?
define('GSNOUPLOADIFY', 1);

So I guess, it uses uploadify?
If I comment the line, I'm not able to upload anything cause the buttons are missing.

I also tried your fix for the image-background color but it didn't work, unfortunately.
However, I'm glad that it already works and so I can live with it.
The problem with the min/max setting is, that the pictures may have a different ratio, when getting uploaded.
So it could be that there's a 3:4 picture or a 16:9 picture.

I'm using a design of html5up.net and just a slightly different ratio of the picture, scrambles the design.
That's why I had to fix the image size. Of course, I could've fiddled with the CSS-styles but that would've taken ages probably and a fixed image size is a quick-fix Wink.

Years ago, when CSS was still not so overloaded with stuff and features, things were easy to settle.
But nowadays, with the main.css of that design having around 2600 lines of CSS, it's almost impossible to make design-changes without screwing everything Big Grin.
Well, at least, that's how I feel Wink.

Have a nice weekend.
Cheers.
Shasaar
Reply
#69
(2017-09-02, 01:46:43)Shasaar Wrote: My GS-config is set to:
Quote:# Use Uploadify to upload files?
define('GSNOUPLOADIFY', 1);

You have uploadify disabled – the logic is reversed (gsNOuploadify). It requires Flash, so if you don't have a Flash plugin in your browser, the upload button won't work.

If you have a blank upload button, you probably have Flash installed, but set to 'Always ask': in this case, you can click on the blank button and you will be prompted to allow the plugin. (This is the case for Firefox.)

Anyway, thank you for your original fix as it inspired me to find the uploadify one.

I had problems with the black bars on a site a couple of years ago and gave up looking for a solution. Sorry I couldn't help!
--
Nick.
Reply
#70
To avoid editing GS core files, make the following changes to Imagizer.php:

Distributed file, lines 56-65, inclusive:
PHP Code:
    if(is_array($file['name'])){
        foreach($file['name'] as $key => $name){
            if (in_array($file['type'][$key],$image_types) || in_array(strtolower(pathinfo($name,PATHINFO_EXTENSION)),$image_ext) ){
                process_file($target_dir clean_img_name(to7bit($name)), $config);
            }
        }
    }
    elseif (in_array($file['type'],$image_types) || in_array(strtolower(pathinfo($file['name'],PATHINFO_EXTENSION)),$image_ext) ){
        process_file($target_dir clean_img_name(to7bit($file['name'])), $config);
    

Replace the above with the following lines:
PHP Code:
    if(is_array($file['name'])){
        foreach($file['name'] as $key => $name){
            if (in_array($file['type'][$key],$image_types) || in_array(strtolower(pathinfo($name,PATHINFO_EXTENSION)),$image_ext) ){
                $file_to_process $target_dir strtolower(clean_img_name(to7bit($file['name'])));
                rename($target_dir clean_img_name(pathinfo($file['name'],PATHINFO_FILENAME)).'.'.pathinfo($file['name'],PATHINFO_EXTENSION),$file_to_process);
                process_file($file_to_process$config);
            }
        }
    }
    elseif (in_array($file['type'],$image_types) || in_array(strtolower(pathinfo($file['name'],PATHINFO_EXTENSION)),$image_ext) ){
        $file_to_process $target_dir strtolower(clean_img_name(to7bit($file['name'])));
        rename($target_dir clean_img_name(pathinfo($file['name'],PATHINFO_FILENAME)).'.'.pathinfo($file['name'],PATHINFO_EXTENSION),$file_to_process);
        process_file($file_to_process$config);
    

This renames the uploaded file with lowercase extension before processing with Imagizer.

Submitted as a patch to Zorato's github page.
--
Nick.
Reply
#71
(2017-09-10, 23:23:19)hameau Wrote: Submitted as a patch to Zorato's github page.

Hey, I have merged the PR. Unfortunately, I can't upload the updated version to Extend Repository, getting 

Quote:ERROR: Could not obtain plugins filename

error. Could you update it yourself or let me know what is the issue?
Anyway, thanks for your contribution and for still using this plugin. I'm glad people still find it useful!  Smile
Cheers.
Reply
#72
(2017-09-11, 18:20:49)Zorato Wrote: I'm glad people still find it useful!

Thank you for continuing to support the plugin. Smartphone photos are not getting any smaller!  Wink
--
Nick.
Reply
#73
(2017-09-11, 18:20:49)Zorato Wrote: Hey, I have merged the PR. Unfortunately, I can't upload the updated version to Extend Repository, getting 

Quote:ERROR: Could not obtain plugins filename

error.

Did you put the plugin in a subfolder inside the zipfile? Files must be in the root of the zipfile.
Reply
#74
Hi and thanks for this plugin. Smile

Does it work with KCFinder file manager or Responsive file manager?
Reply
#75
Is there any other plugin that works similarly? This plugin is basically useless. Flash is dead, plugin is not working.
Reply




Users browsing this thread: 1 Guest(s)