2010-10-30 24 views
3

salut je voudrais savoir comment je peux créer une image de fichier temporaire (png) dans ruby, parce que tempfile vous obtient seulement un nom de fichier aléatoire, mais il n'a pas de fichier d'extension.fichier image temporaire en ruby ​​

Répondre

4

check the documentation!

# Use the Array form to enforce an extension in the filename: 
    file = Tempfile.new(['hello', '.jpg']) 
    file.path # => something like: "/tmp/foo2843-8392-92849382--0.jpg"