• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

    • ⚠️ Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • ✅ Confirm that the server meets the System Requirements
    • 🔥 Check for any available Hotfix - your issue could be already reported/fixed
    • 📚 Read documentation - It will be required to Debug and understand Errors for a faster support response

Q: Would be possible to only allow uploads with X data on EXIFF?

ataliano

Chevereto Member
Hi guys,

I'm using Chevereto as image hosting for my new site. But what I wanted to create is an specific device sharing image hosting service. So far I thought that maybe there would be a way to only allow files which has on its EXIFF file the details and models I want to be allowed.

As the idea is to have a network for people using only those devices (they're few of them) my first idea was that. I know that it's not an standard feature on the software itself, but just wanted to know if with a bit of coding capabilities would be hard to do a thing like these to be implemented within your system.

Any ideas or suggestions?

As said, the objective is to limit uploads to an exclusive format with matching data at "model" EXIFF data which is being readed by the service as you can see the details at the website.

Cheers!
 
Actually is not that hard. You only need to intercept the uploadToWebsite function. Go to app/lib/classes/class.image.php and find this:
PHP:
$image_upload = self::upload($source, $upload_path, NULL, $upload_options);

At that point the image is on disk, but not in the database (Image::insert() is needed for that) so you need to do your work just below that line. The $image_upload array will contain all the image info and the exif will be at:
PHP:
$image_upload['source']['image_exif']

Note that the image_exif will be json_encoded, you need to json_decode it. Then you will get access to all the image_exif info if exists and do anything you want. If the image don't match what you need you only need to throw an execption like this:
PHP:
if($exif['something'] != 'mymatch') {
    throw new Exception('Invalid exif data', 123);
}

And if you need to compare against several possible values you should use in_array().

Hope it helps.
 
Hi Rodolfo,

Helps a lot! :) thanks so much.

Currently there are a lot of image hosting service which allows you to upload any kind of image, that's why my idea is to make a hub for an specific device, in order to avoid having to check all photos uploaded (which can be a mess) I thuoght that could be a nice filter, at least it won't require so much moderation. I'll try to play with it to see if I can do something.

Again, thanks a lot! :)
 
Back
Top