Jump to content

ttttim

Members
  • Posts

    63
  • Joined

  • Last visited

Posts posted by ttttim

  1. I was recently experimenting with optimizing my images to get better load results. The code below is an example of what i've been using. It works nicely but the main problem is if i load a page for the first time after having added a few images my server will overload and return a 503 error. I have to refresh the page a few times for the server to resize all the images. Not a big problem while developing but not something I want on my live website. 

    <picture>
    	<source media='(max-width: 320px)' srcset='{$image->width(320)->url} 1x, {$image->width(640)->url} 2x'>
    	<source media='(max-width: 375px)' srcset='{$image->width(375)->url} 1x, {$image->width(750)->url} 2x'>
    	<source media='(max-width: 767px)' srcset='{$image->width(750)->url} 1x, {$image->width(1500)->url} 2x'>
    	<source media='(max-width: 1023px)' srcset='{$image->width(300)->url} 1x, {$image->width(600)->url} 2x'>
    	<source media='(max-width: 1319px)' srcset='{$image->width(450)->url} 1x, {$image->width(900)->url} 2x'>
    	<source media='(min-width: 1320px)' srcset='{$image->width(510)->url} 1x, {$image->width(1020)->url} 2x'>
    	<img src='{$image->width(1056)->url}' alt='$image->description'>
    </picture>";

    Is there a way to create these different sizes without overloading my server? 

    Ideally i'd like to expand the above code with webp support and a service like tinyPNG to reduce image size even further, but that would stretch the first load time even further. 

  2. Someone recently pointed to me that I wasn't using http strict transport security header. From what I've read it forces a connection to https instead of http. Is there a different compared to the use of the default method from the ProcessWire .htaccess?

    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

     

  3. I'm building an upload form for user to add images to a page. I would like for the user to change the image order after they add the images. Basically how the image field in the backend works. So users can drag and drop the image order. 

    The problem is that I don't know how to rearrange the data of my image field based on the order a user submits?

     

  4. I have an event page were you can select multiple sub-categories with a page field using checkboxes. Now i want to display all the sub-categories but also have them sorted by their parent category. I tried something lik below but that didn't work.

    $tags = $event_cat->find("sort=$event_cat->parent");
    foreach ($tags as $tag){
    	echo $tag;
    }

    Any ideas?

  5. I have a parent page containing a list of it's children. When you click on one of the children the page opens up in a modal box trough ajax. So far so good. 

    But if i directly load the page through the url (parent/child) i get the child page. Is there a way of loading the parent page instead with the child page opened inside the modal box? I was first thinking of using URLSegments so it would load the parent page with the child name as segment however since the segment is an actual page it will load the page instead.

    Any ideas?

  6. Hi,

    I want to upgrade my 2.6 processwire to the new 2.71 but when i go to the upgrade page i get the following error message.

     Error loading GitHub branches https://api.github.com/repos/ryancramerdesign/Processwire/branches#0...'>https://api.github.com/repos/ryancramerdesign/Processwire/branches#0... 2 mins 
    Error loading GitHub branches https://api.github.com/repos/ryancramerdesign/Processwire/branches#0 /mnt/webs/a1/32/54491832/htdocs/processwire/site/modules/ProcessWireUpgrade/ProcessWireUpgradeCheck.module(129): ProcessWireUpgradeCheck->getCoreBranches() #1 /mnt/webs/a1/32/54491832/htdocs/processwire/site/modules/ProcessWireUpgrade/ProcessWireUpgrade.module(164): ProcessWireUpgradeCheck->getVersions() #2 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/ProcessController.php(213): ProcessWireUpgrade->execute() #3 [internal function]: ProcessController->___execute() #4 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(387): call_user_func_array(Array, Array) #5 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(325): Wire->runHooks('execute', Array) #6 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/admin.php(93): Wire->__call('execute', Array) #7 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/admin.php(93): ProcessController->execute() #8 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/modules/AdminTheme/AdminThemeDefault/controller.php(13): require('/mnt/webs/a1/32...') #9 /mnt/webs/a1/32/54491832/htdocs/processwire/site/templates/admin.php(15): require('/mnt/webs/a1/32...') #10 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/TemplateFile.php(169): require('/mnt/webs/a1/32...') #11 [internal function]: TemplateFile->___render() #12 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(387): call_user_func_array(Array, Array) #13 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(325): Wire->runHooks('render', Array) #14 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/modules/PageRender.module(385): Wire->__call('render', Array) #15 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/modules/PageRender.module(385): TemplateFile->render() #16 [internal function]: PageRender->___renderPage(Object(HookEvent)) #17 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(387): call_user_func_array(Array, Array) #18 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(325): Wire->runHooks('renderPage', Array) #19 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(409): Wire->__call('renderPage', Array) #20 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(409): PageRender->renderPage(Object(HookEvent)) #21 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(325): Wire->runHooks('render', Array) #22 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/modules/Process/ProcessPageView.module(187): Wire->__call('render', Array) #23 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/modules/Process/ProcessPageView.module(187): Page->render() #24 [internal function]: ProcessPageView->___execute(true) #25 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(387): call_user_func_array(Array, Array) #26 /mnt/webs/a1/32/54491832/htdocs/processwire/wire/core/Wire.php(325): Wire->runHooks('execute', Array) #27 /mnt/webs/a1/32/54491832/htdocs/processwire/index.php(241): Wire->__call('execute', Array) #28 /mnt/webs/a1/32/54491832/htdocs/processwire/index.php(241): ProcessPageView->execute(true) #29 {main}
    

    Any ideas how to fix this problem? I know I can upgrade manually but i'd like to do it thought the admin area. 

  7. I'm having some troubles with the form. 

    I've setup everything on my localhost and every thing seems to be working fine. Then i've copied everything to my server and for some reason the form stopped working. 

    When I fill in all the field i get an error: 'Please verify the data you have entered.' even though everything looks fine. The weird part is that is doesn't say anything in the Logfile. 

    Do you have any idea what the problem could be?

×
×
  • Create New...