[OzzModz] Cloudflare Image Resizing - On Demand Responsive Images

[OzzModz] Cloudflare Image Resizing - On Demand Responsive Images [Paid] 2.0.0 Patch Level 1

No permission to buy ($40.00)

eL_

Well-known member
I just got this error.

Server error log
Code:
    ErrorException: Template error: [E_WARNING] Undefined variable $srcset src/addons/Nulumia/CFImageResizing/Callback/AttachmentFormatter.php:39

    Generated by: eL_ Dec 7, 2022 at 4:47 PM

Stack trace
Code:
#0 src/addons/Nulumia/CFImageResizing/Callback/AttachmentFormatter.php(39): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] Und...', '/home/weplaypro...', 39)
#1 src/XF/Template/Templater.php(1695): Nulumia\CFImageResizing\Callback\AttachmentFormatter::renderSrcset('', Array, Object(Nulumia\XFOptimize\XF\Template\Templater))
#2 internal_data/code_cache/templates/l1/s39/public/lightbox_macros.php(124): XF\Template\Templater->callback('Nulumia\\CFImage...', 'renderSrcset', '', Array)
#3 src/XF/Template/Templater.php(824): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, NULL)
#4 internal_data/code_cache/templates/l1/s39/public/bb_code_tag_attach.php(80): XF\Template\Templater->callMacro('lightbox_macros', 'single_image', Array, Array)
#5 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, NULL)
#6 src/XF/BbCode/Renderer/Html.php(528): XF\Template\Templater->renderTemplate('bb_code_tag_att...', Array)
#7 src/addons/Nulumia/SeoTools/XF/BbCode/Renderer/Html.php(76): XF\BbCode\Renderer\Html->getRenderedAttachment(Object(Nulumia\SeoTools\XF\Entity\Attachment), Array)
#8 src/XF/BbCode/Renderer/Html.php(523): Nulumia\SeoTools\XF\BbCode\Renderer\Html->getRenderedAttachment(Object(Nulumia\SeoTools\XF\Entity\Attachment), Array)
#9 src/XF/BbCode/Renderer/Html.php(310): XF\BbCode\Renderer\Html->renderTagAttach(Array, Array, Array, Array, Object(s9e\MediaSites\XF\BbCode\Renderer\Html))
#10 src/addons/s9e/MediaSites/XF/BbCode/Renderer/Html.php(14): XF\BbCode\Renderer\Html->renderTag(Array, Array)
#11 src/XF/BbCode/Traverser.php(63): s9e\MediaSites\XF\BbCode\Renderer\Html->renderTag(Array, Array)
#12 src/XF/BbCode/Renderer/Html.php(447): XF\BbCode\Traverser->renderSubTree(Array, Array)
#13 src/XF/BbCode/Renderer/Html.php(310): XF\BbCode\Renderer\Html->renderTagAlign(Array, NULL, Array, Array, Object(s9e\MediaSites\XF\BbCode\Renderer\Html))
#14 src/addons/s9e/MediaSites/XF/BbCode/Renderer/Html.php(14): XF\BbCode\Renderer\Html->renderTag(Array, Array)
#15 src/XF/BbCode/Traverser.php(63): s9e\MediaSites\XF\BbCode\Renderer\Html->renderTag(Array, Array)
#16 src/XF/BbCode/Traverser.php(39): XF\BbCode\Traverser->renderSubTree(Array, Array)
#17 src/XF/BbCode/Traverser.php(22): XF\BbCode\Traverser->renderAst(Array, Object(XF\BbCode\RuleSet), Array)
#18 src/XF/SubContainer/BbCode.php(222): XF\BbCode\Traverser->render('[CENTER][ATTACH...', Object(XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
#19 src/XF/Template/Templater.php(2387): XF\SubContainer\BbCode->render('[CENTER][ATTACH...', 'html', 'post', Object(OzzModz\UserFakeActivity\XF\Entity\Post), Array)
#20 src/XF/Template/Templater.php(1128): XF\Template\Templater->fnBbCode(Object(Nulumia\XFOptimize\XF\Template\Templater), false, '[CENTER][ATTACH...', 'post', Object(OzzModz\UserFakeActivity\XF\Entity\Post))
#21 internal_data/code_cache/templates/l1/s39/public/post_macros.php(434): XF\Template\Templater->func('bb_code', Array, false)
#22 src/XF/Template/Templater.php(824): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, NULL)
#23 internal_data/code_cache/templates/l1/s39/public/post_macros.php(61): XF\Template\Templater->callMacro('post_macros', 'post_user_conte...', Array, Array)
#24 src/XF/Template/Templater.php(987): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#25 src/XF/Template/Templater.php(923): XF\Template\Templater->renderExtensionInternal('user_content', Array, Array, Object(XF\Template\ExtensionSet))
#26 internal_data/code_cache/templates/l1/s39/public/post_macros.php(95): XF\Template\Templater->renderExtension('user_content', Array, Object(XF\Template\ExtensionSet))
#27 src/XF/Template/Templater.php(987): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#28 src/XF/Template/Templater.php(923): XF\Template\Templater->renderExtensionInternal('content', Array, Array, Object(XF\Template\ExtensionSet))
#29 internal_data/code_cache/templates/l1/s39/public/post_macros.php(124): XF\Template\Templater->renderExtension('content', Array, Object(XF\Template\ExtensionSet))
#30 src/XF/Template/Templater.php(987): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#31 src/XF/Template/Templater.php(923): XF\Template\Templater->renderExtensionInternal('main_cell_inner', Array, Array, Object(XF\Template\ExtensionSet))
#32 internal_data/code_cache/templates/l1/s39/public/post_macros.php(142): XF\Template\Templater->renderExtension('main_cell_inner', Array, Object(XF\Template\ExtensionSet))
#33 src/XF/Template/Templater.php(987): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#34 src/XF/Template/Templater.php(923): XF\Template\Templater->renderExtensionInternal('main_cell', Array, Array, Object(XF\Template\ExtensionSet))
#35 internal_data/code_cache/templates/l1/s39/public/post_macros.php(154): XF\Template\Templater->renderExtension('main_cell', Array, Object(XF\Template\ExtensionSet))
#36 src/XF/Template/Templater.php(987): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#37 src/XF/Template/Templater.php(923): XF\Template\Templater->renderExtensionInternal('full_body', Array, Array, Object(XF\Template\ExtensionSet))
#38 internal_data/code_cache/templates/l1/s39/public/post_macros.php(205): XF\Template\Templater->renderExtension('full_body', Array, Object(XF\Template\ExtensionSet))
#39 src/XF/Template/Templater.php(824): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#40 internal_data/code_cache/templates/l1/s39/public/thread_view.php(889): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array)
#41 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(Nulumia\XFOptimize\XF\Template\Templater), Array, Object(XF\Template\ExtensionSet))
#42 src/XF/Template/Templater.php(1642): XF\Template\Templater->renderTemplate('thread_view', Array, true, NULL)
#43 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thread_view_typ...', Array)
#44 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#45 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:Thread\\ViewT...', 'public:thread_v...', Array)
#46 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(Nulumia\XFOptimize\XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#47 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(Nulumia\XFOptimize\XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#48 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#49 src/XF/App.php(2353): XF\Mvc\Dispatcher->run()
#50 src/XF.php(524): XF\App->run()
#51 index.php(20): XF::runApp('XF\\Pub\\App')
#52 {main}

Request state
Code:
array(4) {
  ["url"] => string(36) "/threads/anyone-into-logo-design.15/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 

MRaburn

Active member
Any update on this? The only thing I can see for sure that is weird is if I am logged in as Admin, I get broken image, 403 error and the log srcset error. If I am NOT logged in, then the image is displayed...

imageresize.png

As admin logged in, this is error from Inspector.

Code:
GET https://www.stangnet.com/cdn-cgi/image/width=1280,format=auto,quality=80,sharpen=1/https://www.stangnet.com/mustang-forums/attachments/img_20210722_232543_385-jpg.705887/ 403

I installed an update the other day and thought it was the FIX but guess not. Im on version 2.0.0.1

Mike
 

MRaburn

Active member
I was able to fix the srcset errors. In your code you are not setting srcset before your IF statement.

Line 24 we did

Code:
$srcset = false;

You could also change line 39 to:

Code:
if (isset($srcset))

in

Code:
src/addons/Nulumia/CFImageResizing/Callback/AttachmentFormatter.php

src/addons/Nulumia/CFImageResizing/Callback/MediaFormatter.php
 

MRaburn

Active member
Feature Suggestion:

-- Allow a setting to bypass/exclude certain nodes/forums.

The main benefit to this app is performance and SEO getting better PageSpeed scores. But it can be expensive. We served 670k requests this last month. $9 / 50k. You do the math. :)

However we have private off topic forums that are not accessed by Google, etc. and the users posts 1000s of images in these forums. If I could exclude these then the forums that do NOT matter would not be added to the optimization and cost.

I'd also like to thumbs up the request to include avatars in the optimization, it's a big penalty as well from PageSpeed.

Mike
 
Top