I have users who will have 2 types of picture images, + avatar image.
Which way is better
Users/picture1,Users/picture2, Users/avatar ?
Or
Picture1,Picture2,Avatar
Names of images will be stored in DB anyway.
So the question is better to store all avatars in one big folder or make separate folder for each user and there inside users folder make folders for avatar, picture and etc ?
Since folders are limited to a maximum number of files (not sure the actual number) then it probably makes sense to divide up the images by user. Of course, if the number of users is very, very large then you could hit a limit on the number of sub-folders.
Can the user have multiple avatar images and/or picture images (more than 2)? If not then it may be overkill to separate the avatar and picture images. Putting them in a single "User" folder or "User/images/" folder may be easiest.
Related
Noticed that images sometimes are sliced up in PDFs.
Steps:
insert an image with a high resoultion (3000x1800) into a .docx
use "Microsoft Print to PDF" option of Word to convert to PDF
extracting all images with pdfimages or pymupdf
Result:
Image is sliced horizontally into three images
Questions:
What exactly happens in the in the transition from .docx to pdf (or in generell in the process to pdf) that makes the converter slice it up into three images instead of one?
Do the individuell XObjects of the sliced images contain information which says that these three images belong to originally one?
How do I know how the images are sliced (horizontally / vertically) and what if originally there were two images inserted into the .docx file and both of them are sliced. Can you tell if slice x belongs to original image y or z?
So, as you have found out: because the code which generates the PDF choose to do so.
The technical reasons may be various - it could be that historically there were printers which would only have so much memory, and would need to get limiterd size-images when printing, and someone at some point when writing the PDF export code present in Microsoft Office choose to apply this limit.
Anyway, technically, as put in the comments, an image in a PDF file could be composed of unlimited smaller images collated together.
Now, the second part, and your actual question: to know whether images ibn a PDF file belong together in a single original image one would need a custom extractor tool to check the geometry of all images in the document and find out which images have no margins or boundaries with others - it would not be that hard to do for well behaved files (which we can't know if MS Office generated files are: there are ways to obfuscate image positioning by making it indirectly). The metadata in the image-parts may or may not contain information that would allow one to recompose the original image: it would be up to the code generating the PDF to include this metadata or not - but the geometry can't lie in this case: if the final document presents a single image visually, it is possible to detect that when fetching the images.
how does shiny handle temporary files?
I have an app where the user uploads images (one by one) and then via officer (and flextable) a document is generated
compose(i=1,j=1, value = as_paragraph(as_image(col1,width = 3.46,height = 2.63)),part = "body") %>%
compose(i=1,j=2, value = as_paragraph(as_image(col2,width = 3.46,height = 2.63)),part = "body")
but when I download the document, the images supposedly are different, but in the docx are the same.
This happens with temporary images. I know it's something with officer since it happened similarly with other segment of the document.
It didn't happened with uploading multiple images at once, but with consecutive fileInput's
is there a way to reset the image rendering or something?
Thank you
Since I used two or more fileInput to upload different images
R/Shiny creates a temporary folder, each one contains 0.jpg for all of the images uploaded
When using officeR to create the documents with images, it ignores the folder, and they all get confused since they are all named 0.jpg.
My solution was to filecopy each image from temporary folders to local folder, and renaming them, and then deleting all images contained.
(still have to try publishing the app but it sounds promising)
weird that it cannot differentiate different images from different (temporary) folders.
My question is not removing duplicated/similar images. I need a tool to process a more complex process:
Find pictures I have manually removed in a folder
Apply this removal in another folder
Replace low-resolution pictures in a folder by High-resolution ones from another folder
I use Linux, but please propose solutions compatible with several OS if possible. I would also appreciate Free/Libre/OpenSource tools.
The below three examples explain the requirements
-1- Basic example: I have an old copy of my SD card on my computer (where I have already removed failed pictures) and I want these failed pictures (worst ones) be automatically removed from my Camera's SD card.
Folder "My-Computer" Folder "SD-Card" ACTION
I23001.JPG I23001.JPG keep duplicate
I23002.JPG I23002.JPG keep duplicate
I23003.JPG remove missing
I23004.JPG remove missing
I23005.JPG I23005.JPG keep duplicate
I23006.JPG remove missing
I23007.JPG remove missing
I23008.JPG I23008.JPG keep duplicate
I23009.JPG copy new picture
I23010.JPG copy new picture
I23011.JPG copy new picture
In real life, pictures are also copied on mobile phones, web gallery, cloud, backup... and failed pictures may also be removed on different devices...
-2- More complex example: I take picture using camera/smartphone/tablet. I also manually remove failed pictures (worst ones) on computer/camera/smartphone/tablet. We want best pictures being copied an all devices to view/show them.
"My-Computer" "SD-Card" "Smartphone" ACTION
I23001.JPG I23001.JPG I23001.JPG keep duplicate
I23002.JPG I23002.JPG ask user
I23003.JPG I23003.JPG ask user
I23004.JPG remove missing
I23005.JPG I23005.JPG I23005.JPG keep duplicate
P89001.JPG P89001.JPG keep duplicate
P89002.JPG P89002.JPG keep duplicate
P89003.JPG remove missing
P89004.JPG P89004.JPG keep duplicate
I23006.JPG I23006.JPG remove missing
I23007.JPG I23007.JPG remove missing
I23008.JPG I23008.JPG I23008.JPG keep duplicate
I23009.JPG copy new picture
I23010.JPG copy new picture
I23011.JPG copy new picture
P89005.JPG P89005.JPG keep duplicate
P89006.JPG copy new picture
P89007.JPG copy new picture
P89008.JPG copy new picture
-3- Very complex: I copy pictures from my camera to my smartphone using the camera's Wi-Fi access point, but the pictures are reduced (similar image content but not exact duplicate file). I also copy pictures to my friend's smartphone. We also take photos using our smartphone and copy some ones (best ones) to the other smartphone. And we also process the same with tablets. Manual removal is done on any device.
example too messed to be displayed here!
Analysis
List of duplicates finders:
Duplicate file finders on Wikipedia
Search word "duplicate" in image viewer comparison on Wikipedia
Interesting tools:
findimagedups from Jonathan H N Chin, perl script (and C lib) storing image fingerprints into a Berkley DB file and printing together filenames of images matching more than xx% similarity (pictures taken in burst mode may be flagged as similar)
findimagedupes version in Go
gThumb can also find/remove duplicates
Geeqie
imgSeek
digiKam and its Find Duplicate Images Tool
Visipics
dupeGuru Picture Edition
Tools lacking of similar image recognition:
fslint
duff
fdups
rmlint
Coding a new tool
As I did not (yet) find any solution I was thinking of developing a new software:
Modify a command line tools like findimagedups in order to provide the matching distance between images (similarity percentage)
This output may be a graph
each file is a node
edges (relations between files):
content matching (similarity percentage, crop, similar region)
in same folder, in a neighborhood folder
similar filename, successive filename numbering
similar date/time
similar metadata
similar resolution
For each group of content-similar nodes
one folder = one column
one file by raw, if duplicates in same folder (e.g. burst mode)
missing file in one folder = blank
similarity of files are provided in horizontal/vertical neighborhood only
Automatically selection of:
files to be replaced (low resolution replaced by high resolution, except in folder called "small")
files to be removed
User can display pictures and check connection properties
I’ve been thinking a while about the best solution and as much as I read I get more and more confused. There are a lot of different libraries and helpers (most of them are outdated or for CI 1.x) and I really need your help.
I have a custom CMS based on CodeIgniter 2.1.3, news site that has about 40-50 images on the home page, but 80% of them are really small thumbnails in 3 different sizes and the other 20% of the images on the home page are in 2 sizes + for the inner pages when I list the news from a category there is 1 size of thumbnails. So in total I will need the original image for the news story, + 5-6 thumbnails sizes for the home page.
What’s the smartest way to deal with this? There will be let’s say 10-50 new news per day.
Is it still better to create 5-6 thumbnails per image during the upload?
What about the method “on the fly”? I’m more into this method, as I read, only the first visitor will call the library/helper to generate the thumbnails, and for the others the thumbnails will be already created so it won’t waste CPU. What about this method? Is it good practice?
What caching techniques I should use for these what I need?
Also I forgot to ask, how the other CMS system deal with generating the thumbnails? I mean about Wordpress, Drupal, Joomla, etc.
Do they store predefined sizes or generate them on the fly?
I guess their logic should be the best, or maybe not, but I want to implement something smart in my CodeIgniter CMS.
I didn’t mention, but I think it’s not important to this, I use Grocery CRUD for the admin panel.
Any help is appreciated.
Your best bet is to create images on the fly + use CDN like Amazon Cloudfront to cache the resized versions of your source image.
I’ve been using CodeIgniter for a number of years to build websites where lots of different sizes of images are used throughout the website. At the beginning I used to create every size needed out of the original image during the upload process (could easily end up with more than 5 thumbnails). This proved to be delivering the best performance – whenever you need an image of the certain size you just include it with no additional PHP processing. However I noticed that I end up with a huge number of images on the server, where the older ones may not even be used that often (e.g.: articles older than a year). Plus developing this way takes longer.
Then I started creating images on the fly, firstly using 3rd party libraries and later developed my own interface for CodeIgniter. This saves a lot of time, because during the upload process you save an original version of the image not worrying about resized versions. When displaying an image in the front end, all you normally need to do is to pass certain dimensions of the image required. Doing this way, not only you can get 5-6 versions of the image, but as many as you need. Also that’s a solution for the future when you redesign your website where the different sized images might be needed! What would you do when none of your 5 thumbnail options are no longer valid and you need different sizes?
You’re right, resizing an image on the fly can really be CPU consuming operation (especially when the large images are involved), therefore caching is a must. You can cache images right on your server or get CDN on top of that.
To keep the server tidy I normally run a cron job to delete on-the-fly images older than let's say a week. That saves space + doesn't cause harm - whenever image is needed to display, it'll just get recreated.
Check out timthumb, it's a script that resizes images on the fly and stores them in a cache. It's a simple as including an image tag with parameters in the URL.
ALso check this link which looks promising http://www.jenssegers.be/blog/31/Codeigniter-resizing-and-cropping-images-on-the-fly-continued
I love the way Drupal manage this. In Drupal 6 there was a module called imagecache (now is in core in Drupal 7, but functionality is very similar), which basically stores presets for images (image sizes, transformations, effects...) and when the visitor ask for an image the module generate different images based on presets and serve this images. This way you upload an image but have different images for different purposes.
The module has a really useful feature, if you want to change one preset, you can "flush" all the images related with that preset, so the visitors can see the changes.
Of course there are many other modules in Drupal related to imagecache or image styles, that add other effects like watermarks...
More information:
http://drupal.org/node/949222
http://drupal.org/node/163561
I made few forms in Access 2010 and I add logo of company to the header form. This picture is .jpg and size of it is 70KB. I don't know why size of .mdb immediately increased from 4MB to 12MB? (few forms and the same logo) Maybe there is some options of image compression ?
Taken from http://office.microsoft.com/en-us/access-help/store-images-in-a-database-HP005280225.aspx
..."However, embedding images can rapidly inflate the size of your
database and cause it to run slowly. This is especially true if you
store GIF and JPEG files, because OLE creates additional bitmap files
that contain display information for each of your image files, and
those additional files can be larger than your original images. In
addition, this method only supports the Windows Bitmap (.bmp) and
Device Independent Bitmap (.dib) graphic file formats. If you want to
display other common types of image files, such as GIF and JPEG
images, you have to install additional software."...
To explain how these bitmap files are stored, the link below offers more explanation than the microsoft site:
Taken from http://www.ammara.com/support/kb/showkbe5cc.html
..."OLE Linking & Embedding is a technique used by Microsoft Access to
store 'Objects' in database tables.The technique relies on the
associated external application to store, present and edit the data.
In some cases an additional uncompressed 'preview' image is also saved
in the table (even when linking). This preview image is used for
faster display of the data, or when the server application isn't
available. This can cause a massive overhead. If you're storing jpeg
images the uncompressed preview can be ten or twenty times the actual
image size, causing the size of the database to rocket."...
So, when you drop an image onto a form in MS Access, uncompressed image data is saved to the system tables. This is actual uncompressed table data, so a compact and repair may offer little help.
The common workaround seems to be store the path to the image in a database table, and use that path to invoke the image on the form.
I don't know WHY (and I don't care) but I already noticed that behaviour as well. My workaround for company logos or equivalent is to insert it in ONE form, which I then insert as a subform wherever I need it. It has the added benefit that if the logo changes one day, there is only one place to update.