Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Image Corruption

  1. #1
    Join Date
    Aug 2019
    Beans
    5

    Image Corruption

    Hello,

    I have a new install of Ubuntu server 18.04. This server is just to serve a image slideshow on a web browser. When I started the apache server and the PHP script, any images in the folder that are bigger then 200kb only load part of the image then the rest of the image is blank. Thinking it was part of the PHP script or someting in Apache, I browsed to the picture folder from Chrome. When I clicked on the images, I only got part of the image as well. If I sftp to the linux server, I get the full picture. So, I know the image is not corrupted. This only happens when I open the images from a web browser. Since it's not specific to Apache, I don't know what log to look for. Has anyone seen this before? Thank you.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    17,172
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Image Corruption

    check the resolutions for each image.

  3. #3
    Join Date
    Aug 2019
    Beans
    5

    Re: Image Corruption

    Thank you for the reply. I did some testing in Photoshop. I brought the resolution down to 600 x 450 @ 72DPI. More of the image loaded, but there were still digital artifacts in the image. Then I brought the jpeg compression down to make the image size smaller, it loaded fine once I got under 150KB. It seems like this is a problem with the file size.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    17,172
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Image Corruption

    For web publishing of images, I generally use a batch solution:
    Code:
    #!/bin/bash
    QUAL=40
    for img in "$@"; do
      NEW=${img/%.???/-opt.jpg}
      echo " Working on $img ..."
       convert -quality $QUAL  "$img"  "$NEW"
    done
    echo "rename 's/-opt.jpg/.jpg/g' "
    You'll need convert and rename tools, though it doesn't rename the new image files as scripted above. Convert is part of imageMagick suite. Tweak the QUAL setting to your needs.

    Also, the image files can't have spaces in the names and funny characters could cause problems.

    Photoshop ... ewwww. I feel dirty.

  5. #5
    Join Date
    Aug 2019
    Beans
    5

    Re: Image Corruption

    The thing that's confusing me about this is that I have an older system based on ubuntu 14 and Apache 2.4.7. The images show fine on that system both directly loaded in the browser and with my PHP script. That's why I'm thinking it's an Apache setting or something. I just don't know where to look for that.
    Last edited by computeraudio; 1 Week Ago at 05:31 PM.

  6. #6
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    17,172
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Image Corruption

    Could be a php.ini setting too. Or a proxy or security setting for mod_proxy or mod_security. I don't use php or apache enough to help. Sorry.

    A better title for this thread would have been "Php file download size limits on Ubuntu 18.04"
    You want people familiar with websites and php and Ubuntu 18.04. Apache would probably be assumed, titles that are too long cut off the endings from view.

    Out of those, I'm only familiar with websites.

    Image Corruption sounds like a bad HDD or a desktop problem, which isn't likely to get the experts you want.

    Apache settings are always under /etc/ somewhere. That's a distro thing, if the distro uses some sort of package manager. I'd use fgrep to search all the files in the apache settings directory structure for limit or size stuff.
    Last edited by TheFu; 1 Week Ago at 06:12 PM.

  7. #7
    Join Date
    Sep 2011
    Location
    Behind you!
    Beans
    1,080
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Image Corruption

    Apache default settings (at least for all versions of Ubuntu) allows for 8 MB files to be uploaded. I am not aware of a download limitation. Every image on my site, including large ones will display in any browser I test.

    If you want to modify the upload size to be 2048 MB, this is how:

    Code:
    sudo vi /etc/php/7.2/apache2/php.ini
    Find and modify these values:
    Code:
    post_max_size = 2058M
    upload_max_filesize = 2048M
    Then reload the settings:
    Code:
    systemctl reload apache2
    Are your images actually corrupt on the server? Did your upload/copy process corrupt them? How exactly are you uploading them?

    How are you displaying them to the browser. You mention PHP but the code that actually displays images is HTML such as:
    Code:
    <img src="myfile.jpg" />
    LHammonds

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    17,172
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Image Corruption

    I read that some browsers have issues with some image files. Try different browsers, perhaps there is a clear issue with 1 or 2 of them, but all the others work fine. I like dillo. It is small, VERY fast and doesn't support things I consider dangerous.

  9. #9
    Join Date
    Aug 2019
    Beans
    5

    Re: Image Corruption

    Thank you guy for your help so far. LHammons, I have the images on a Windows NTFS drive and am using cifs to mount the remote folder. When I SFTP to the server and download the image, they load fine. On the browser, I'm going to http://server/images folder/image.jpg and that doesn't load the whole image either. For PHP, it generates a <img src="myfile.jpg" />.

  10. #10
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    17,172
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Image Corruption

    Spaces in directories or files can cause unexpected issues if a programmer didn't quote the entire name in every place it is used.
    Old-time Unix guys know to avoid spaces and funny characters in directories and filenames.

    I'd check the apache logs to see exactly which files are being served.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •