Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6744725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:07:05+00:00 2026-05-26T12:07:05+00:00

I have a feature on my site where a user can upload a background

  • 0

I have a feature on my site where a user can upload a background image for their specific “channel.” The problem that I’m having is that some users upload pictures at resolutions of 3000+px x 2000+px while others upload at 1280 x 720, and so on.

What is the best way to go about this situation? Should I keep letting them upload huge resolutions like that? Or restrict the upload to a certain pixel amount? How would I go about doing this?

Here is where the user can upload a background image:

<?
$images = glob(base_root().'uploads/channels/'. $Channels->id .'/background/{*.jpg,*.Jpg,*.JPG,*.jpeg,*.Jpeg,*.JPEG,*.gif,*.Gif,*.GIF,*.png,*.Png,*.PNG}', GLOB_BRACE);
if(is_array($images) AND count($images) >= 1) {
     $imagePaths = pathinfo($images[0]);
$channelBackgroundSrc = base_url() .'uploads/channels/'. $Channels->id .'/background/'.    $imagePaths['basename'] .'?rand='.  mt_rand(0, 9999);
?>

Here is the code that is on the top of each user’s “channel” where it gets the background image for that specific channel.

$(document).ready(function() {
    <?
    $images = glob(base_root().'uploads/channels/'. $channel['id'] .'/background/{*.jpg,*.Jpg,*.JPG,*.jpeg,*.Jpeg,*.JPEG,*.gif,*.Gif,*.GIF,*.png,*.Png,*.PNG}', GLOB_BRACE);
    if(is_array($images) AND count($images) >= 1) {
        $imagePaths = pathinfo($images[0]);
        $channelBackgroundSrc = base_url() .'uploads/channels/'. $channel['id'] .'/background/'. $imagePaths['basename'] .'?rand='.  mt_rand(0, 9999);
    ?>
        document.getElementById('userBackground');
        $("#userBackground").css("background", "url('<?=$channelBackgroundSrc?>') repeat-x scroll 0px 0px transparent");
        $("#userBackground").css("background-attachment", "fixed");
    <?
    }
    ?>

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:07:06+00:00Added an answer on May 26, 2026 at 12:07 pm

    I think the best approach is limit the upload filesize from php.ini, and then do a server image resize to finally store it in an optimal resolution.

    Here is a great code to resize images in PHP
    http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that features some pages which do not require any post-back
I have a client that would like to add a feature to their application
I really hope someone can shed some light on this problem, I have built
I've added a feature to a web site that shows what visitors have visited
I have a site where people can add their favorite TV series. There is
I have created a feature, a publishing site, in Visual Studio to MOSS -
I have a form in a jQuery enabled site. The form does not feature
I have a feature which allows the user to create projects and view it
I have a feature in my product that I would like to be installed
Does Eclipse have a feature that lets you search a project to find all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.