Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ferrari: Improve Image Download Speeds, Part 1 #62

Closed
Harmonickey opened this issue Aug 10, 2015 · 13 comments
Closed

Ferrari: Improve Image Download Speeds, Part 1 #62

Harmonickey opened this issue Aug 10, 2015 · 13 comments

Comments

@Harmonickey
Copy link
Owner

(BRANCH): ferrari/images/62

(DESCRIPTION):I'd like a Fullsize Image slideshow and for the Thumbnails to load quickly.

What you Need to Get Started:

  1. Install RMagick (go through Bluehost to do it)
  2. Include the following code to the require list at the top of create_listing.rb and update_listing.rb
    require 'rmagick'
  3. There is a complicated loop inside of both of those files that check for updates to the pictures array, and decides accordingly what to do about new files, missing files, or no files. You need to integrate with this loop to create/delete your thumbnails with rmagick.
  4. You don't need a thumbnail parameter in the functions themselves, but you do need to insert them into the queryObj. Please insert them the same way as the Pictures array.

(ACCEPTANCE CRITERIA):

  1. When images save, they are saved as Interlaced.
  2. Create a second Thumbnail-sized image(200x300) that is also interlaced.
  3. Save images in a Special Directory Tree: server/imagesaveddir/ListingID/ImageNumber/Thumbnail.jpg or Full.jpg

(PARENT TICKET): none

(DEPENDENT TICKETS):none

@Harmonickey Harmonickey added this to the Phase [1] - Map and Filtering milestone Aug 10, 2015
@Saurutobi
Copy link
Collaborator

so 'forced height/width' is not a thumbnail. You're just telling a 4000x3000 image to shrink but you're still required to download the entire thing. We need to convert the image on the serverside into a thumbnail version that is only 300x200

@Harmonickey
Copy link
Owner Author

ah gotcha, that makes sense. Can you see if you can figure this ticket out? You are pretty knowledgeable about this sort of thing.

The endpoints you want to worry about are dropzone.js on dev.lbkstudios.net/Libraries/Javascript and upload_file.php on images.lbkstudios.net/enhabit

@Saurutobi
Copy link
Collaborator

also that 'bitmapping' just means Interlacing the image.
http://php.net/manual/en/function.imageinterlace.php

@Harmonickey
Copy link
Owner Author

It still might be helpful though to do that, what do you think?

@Saurutobi
Copy link
Collaborator

sure, I'll dig into it tonight

@Saurutobi
Copy link
Collaborator

the key here is to map images properly. I'm thinking: don't give the user the ability to edit imagename on the frontend, and force it to be something we like on the backend("[ListingID]x[imagenumber]"). Then create a folder with that name. Within the folder there will be 2 images saved: Full.jpg and Thumbnail.jpg. For all intents and purposes, the only one we'll use(except for the big slideshow), is [server][imagesavedir][ImageName]\Thumbnail.jpg.

@Saurutobi Saurutobi changed the title Improve Image Download Ferrarri: Improve Image Download Speeds Aug 11, 2015
@Saurutobi Saurutobi changed the title Ferrarri: Improve Image Download Speeds Ferrarri: Improve Image Download Speeds, Part 1 Aug 11, 2015
@Saurutobi Saurutobi changed the title Ferrarri: Improve Image Download Speeds, Part 1 Ferrari: Improve Image Download Speeds, Part 1 Aug 11, 2015
@Harmonickey
Copy link
Owner Author

I HIGHLY recommend you use the Dropzone.js already built in functions to create Thumbnails. They have a .createThumbnailFromUrl() function. Look up some documentation and then just add it to the existing code within the create_listing/update_listing sections.

@Harmonickey
Copy link
Owner Author

I also HIGHLY recommend looking into this method to sort of do it in the backend and then you don't have to learn the dropzone.js stuff. http://davidwalsh.name/create-image-thumbnail-php

Then I can just provide the create_listing and update_listing with the thumbnails in Part 2. I will then be able to grab only the Thumbnail array object from ruby to list on the frontpage and listings view.

@Harmonickey
Copy link
Owner Author

I am thinking about the process of how all of the uploads and stuff flows, these methods won't work, and they won't be easy to implement due to some technicalities. What will likely work best is to create the thumbnails on the fly with Ruby. http://ruby.bastardsbook.com/chapters/image-manipulation/ RMagik should be good. This way, if the write to the database fails, I can still delete the files that were uploaded, including the thumbnails. If we were to do it through dropzone or php, then we would never know which files to delete if the write to the database failed.

@Saurutobi
Copy link
Collaborator

I was actually thinking of doing it in PHP if that was there. I thought
there was a php file and there's a thing in php that let's you save an
image as interlaced, and also save it with different sizes and such. That
was my plan

On Tue, Aug 18, 2015 at 11:06 AM, Alex Ayerdi notifications@github.com
wrote:

I am thinking about the process of how all of the uploads and stuff flows,
these methods won't work, and they won't be easy to implement due to some
technicalities. What will likely work best is to create the thumbnails on
the fly with Ruby.
http://ruby.bastardsbook.com/chapters/image-manipulation/ RMagik should
be good. This way, if the write to the database fails, I can still delete
the files that were uploaded, including the thumbnails. If we were to do it
through dropzone or php, then we would never know which files to delete if
the write to the database failed.


Reply to this email directly or view it on GitHub
#62 (comment).

@Harmonickey
Copy link
Owner Author

Well sure, but what happens if the write to the database fails? Then the files that just got uploaded are hanging on the filesystem without being attached to a listing. This is why I want it in Ruby.

@Saurutobi
Copy link
Collaborator

good thinking. I will attempt to do it with Ruby

On Tue, Aug 18, 2015 at 2:26 PM, Alex Ayerdi notifications@github.com
wrote:

We sure, but what happens if the write to the database fails? Then the
files that just got uploaded are hanging on the filesystem without being
attached to a listing. This is why I want it in Ruby.


Reply to this email directly or view it on GitHub
#62 (comment).

@Harmonickey
Copy link
Owner Author

I have left comments in OP on what you need to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants