Page 1 of 2

SmartImage - not working for me

Posted: Tue Sep 14, 2021 3:15 pm
by johnboyuk1
Hi all

Just trying this new module... but it doesnt seem to do anything for me?!

I have this on my page to test it:

Code: Select all

{SmartImage src="uploads/images/DSC_0011.JPG"}
But its outputting absolutely nothing ... any idea where I'm going wrong?!

Thanks

Re: SmartImage - not working for me

Posted: Tue Sep 14, 2021 7:37 pm
by DIGI3
Check your php error log and cmsms admin log for clues. Also check the generated html to see if it's creating the tag but the path is incorrect or something.

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 5:40 am
by rotezecke
Same issue here. Nothing in PHP error log (PHP 7.4.xx). Admin log shows:
Could not find a file at: uploads/images/DSC_0011.JPG
Edit: actually, there's also a notice in PHP error log:
Could not find a file at: uploads/images/DSC_0011.JPG in /var/www/public_html/modules/SmartImage/action.default.php on line 44
not working:

Code: Select all

{SmartImage src="uploads/images/DSC_0011.JPG"}
but this works:

Code: Select all

{SmartImage src="/uploads/images/DSC_0011.JPG"}
and this too works:

Code: Select all

{SmartImage src="../uploads/images/DSC_0011.JPG"}
and even this works

Code: Select all

{SmartImage src="images/DSC_0011.JPG"}

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 7:50 am
by johnboyuk1
I get absolutely nothing - so no html / tag output at all

Nothing in the error logs either

Tried rotezecke's alternative path suggestions too but made no difference.

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 8:03 am
by johnboyuk1
Ok, ive tried installing on another site - same server/pho set up and it works ok there... so how do I go about tracking down why its not working on this site?!

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 8:06 am
by velden
Wild guess: differences in path related settings in config.php?

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 9:22 am
by johnboyuk1
ok - its something to do with the actual image ... it seems it doesnt like large images?! Which would make the plugin pretty useless for what I need it for - resizing images.

I cant work out whether its the file size or pixel dimensions it doesnt like - but tried the same image at 2.7mb and 1.2mb and got a blank output... if saved at 280kb it will output

Is this a bug?

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 11:25 am
by DIGI3
It's likely a memory issue, there should be an error in your log about it. Check your php memory limit and raise as needed.

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 11:32 am
by johnboyuk1
Logs seem to be empty

PHP effective memory limit is as 128M

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 11:43 am
by johnboyuk1
ok, got it i think! Explicitly set the memory limit in the config file and is working now... must have been some issue where it was showing me the incorrect figure in the system information screen

Also note as per rotezecke's comment, the url does requite the leading slash

so /uploads/images/etc

not uploads/images/etc

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 2:29 pm
by DIGI3
Just a personal preference, I like to use {uploads_url} rather than hardcoding the path, just in case it ever changes for some reason. You'll also never forget the slash in that case as it's the full url. e.g. {SmartImage src="{uploads_url}/images/foo.jpg"}

Re: SmartImage - not working for me

Posted: Wed Sep 15, 2021 2:43 pm
by johnboyuk1
Great - good tip thanks!

Re: SmartImage - not working for me

Posted: Thu Sep 16, 2021 12:38 am
by rotezecke
Could you elaborate on "Explicitly set the memory limit in the config file" please?
I am having the same experience, no output, no error. thats a straight conversion from CGSmartImage to SmartImage. The former works fine, the latter does not (regardless of path). Thanks

Re: SmartImage - not working for me

Posted: Thu Sep 16, 2021 7:38 am
by johnboyuk1
sure, even though my system info said the memory was set at 128M ... i think that may have been some kind of glitch as it wasn't until i set the memory on the config file it started working. So in your config file, add this line:

Code: Select all

ini_set("memory_limit", "128M");

Re: SmartImage - not working for me

Posted: Thu Sep 16, 2021 1:30 pm
by DIGI3
Best to use specific terms, "config file" to most cmsms users means config.php but that looks like it's from your php.ini or user.ini file.