Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git i/languages/de.php w/languages/de.php
- index 11b05de..d4dad4d 100644
- --- i/languages/de.php
- +++ w/languages/de.php
- @@ -209,7 +209,7 @@ return array(
- 'tidypics:uploader:choose' => "Wähle die Bilder aus",
- 'tidypics:uploader:upload' => "Lade die Bilder hoch",
- 'tidypics:uploader:describe' => "Gebe Beschreibungen für die Bilder ein",
- - 'tidypics:uploader:instructs' => 'Das Hochladen von Bilder erfolgt in drei einfachen Schritten: auf dieser Seite kannst Du zuerst die Bilder zum Hochladen auswählen und im Anschluss diese Bilder hochladen. Nachdem das Hochladen abgeschlossen ist, wirst Du automatisch zu einer neuen Seite weitergeleitet, wo Du im letzen Schritt dann Titel und Beschreibungen für diese Bilder eingeben kannst.<br><br> Du kannst bis zu 10 Bilder auf einmal hochladen (maximale Dateigröße %s MB pro Bild).',
- + 'tidypics:uploader:instructs' => 'Das Hochladen von Bilder erfolgt in drei einfachen Schritten: auf dieser Seite kannst Du zuerst die Bilder zum Hochladen auswählen und im Anschluss diese Bilder hochladen. Nachdem das Hochladen abgeschlossen ist, wirst Du automatisch zu einer neuen Seite weitergeleitet, wo Du im letzen Schritt dann Titel und Beschreibungen für diese Bilder eingeben kannst.<br><br> Du kannst bis zu %s Bilder auf einmal hochladen (maximale Dateigröße %s MB pro Bild).',
- 'tidypics:uploader:basic' => 'Du kannst bis zu 10 Bilder auf einmal hochladen (maximale Dateigröße %s MB pro Bild). Nachdem das Hochladen der ausgewählten Bilder abgeschlossen ist, wirst Du automatisch zu einer neuen Seite weitergeleitet, wo Du dann Titel und Beschreibungen für diese Bilder eingeben kannst.',
- 'tidypics:sort:instruct' => 'Sortiere die Bilder im Album durch Drag-and-Drop um. Dann speichere Deine Änderungen.',
- 'tidypics:sort:no_images' => 'Es wurden keine Bilder gefunden, die umsortiert werden könnten. Lade Bilder hoch, indem Du dem obigen Link folgst.',
- @@ -360,4 +360,4 @@ Schau Dir das Bilderalbum an und schreibe einen Kommentar:
- 'image:error' => 'Das Bild konnte nicht gespeichert werden.',
- 'tidypics:upgrade:failed' => "Das Upgrade des Tidypics-Plugins ist gescheitert"
- -);
- \ No newline at end of file
- +);
- diff --git i/languages/en.php w/languages/en.php
- index 2173789..26fbfbe 100644
- --- i/languages/en.php
- +++ w/languages/en.php
- @@ -144,6 +144,9 @@ return array(
- 'tidypics:resize_thumbnails:finished' => "The re-recreation of thumbnails of all %s photos has been finished successfully.",
- 'tidypics:resize_thumbnails:finished_with_errors' => "The re-recreation of thumbnails has been finished. There were some errors though: %s photos with invalid data (no re-creation of thumbnails done here) and on %s photos occured an error during creation of thumbnails.",
- + 'tidypics:settings:maxuploads' => 'Set max uploads allowed via the ajax Plupload',
- + 'tidypics:settings:default_menu' => 'Set menu to all photos or all albums',
- +
- // Server analysis
- 'tidypics:server_info' => 'Server Information',
- 'tidypics:server_info:gd_desc' => 'Elgg requires the GD extension to be loaded',
- @@ -209,7 +212,7 @@ return array(
- 'tidypics:uploader:choose' => "Choose photos",
- 'tidypics:uploader:upload' => "Upload photos",
- 'tidypics:uploader:describe' => "Describe photos",
- - 'tidypics:uploader:instructs' => 'There are three easy steps for adding photos to your album using this uploader: on this page you need to choose the photos to be uploaded first and then upload them in a second step. After the upload has finished you will be automatically redirected to a new page where you can enter titles and descriptions for the uploaded photos as the last step.<br><br> You can upload up to 10 photos at a time (%s MB maximum per photo).',
- + 'tidypics:uploader:instructs' => 'There are three easy steps for adding photos to your album using this uploader: on this page you need to choose the photos to be uploaded first and then upload them in a second step. After the upload has finished you will be automatically redirected to a new page where you can enter titles and descriptions for the uploaded photos as the last step.<br><br> You can upload up to %s photos at a time (%s MB maximum per photo).',
- 'tidypics:uploader:basic' => 'You can upload up to 10 photos at a time (%s MB maximum per photo). After the upload of the selected photos is finished you will be redirected to a new page where you can enter titles and descriptions for the uploaded photos.',
- 'tidypics:sort:instruct' => 'Sort the album photos by dragging and dropping the photos. Then click the save button.',
- 'tidypics:sort:no_images' => 'No photos found to sort. Upload photos using the link above.',
- @@ -360,4 +363,4 @@ View and comment on the album:
- 'image:error' => 'Could not save photo.',
- 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed"
- -);
- \ No newline at end of file
- +);
- diff --git i/languages/es.php w/languages/es.php
- index 685b11f..f3188b7 100644
- --- i/languages/es.php
- +++ w/languages/es.php
- @@ -198,7 +198,7 @@ return array(
- 'tidypics:uploader:choose' => "Elija las fotos",
- 'tidypics:uploader:upload' => "Suba las fotos",
- 'tidypics:uploader:describe' => "Describa las fotos",
- - 'tidypics:uploader:instructs' => 'Hay tres sencillos pasos para agregar fotos a su álbum con este cargador: En esta página es necesario elegir las fotos que se cargan primero y luego subirlas en un segundo paso. Después que la carga haya finalizado, será redirigido a una nueva página donde podrá introducir los títulos y descripciones de las fotos cargadas en el último paso.<br><br> Puedes subir hasta 10 fotos a la vez (%s MB máximo por foto).',
- + 'tidypics:uploader:instructs' => 'Hay tres sencillos pasos para agregar fotos a su álbum con este cargador: En esta página es necesario elegir las fotos que se cargan primero y luego subirlas en un segundo paso. Después que la carga haya finalizado, será redirigido a una nueva página donde podrá introducir los títulos y descripciones de las fotos cargadas en el último paso.<br><br> Puedes subir hasta %s fotos a la vez (%s MB máximo por foto).',
- 'tidypics:uploader:basic' => 'Puedes subir hasta 10 fotos a la vez (%s MB máximo por foto). Una vez finalizada la carga de las fotografías seleccionadas se le redirige a una nueva página donde podrá introducir los títulos y descripciones de las fotos subidas.',
- 'tidypics:sort:instruct' => 'Para clasificar los fotos del álbum arrastr y suelte las fotos. Luego haga clic en el botón Guardar.',
- 'tidypics:sort:no_images' => 'No se encontraron fotos para ordenar. Sube fotos usando el enlace de arriba.',
- @@ -349,4 +349,4 @@ Ver y hacer comentarios sobre el álbum:
- 'image:error' => 'No se pudo guardar la foto.',
- 'tidypics:upgrade:failed' => "La actualización de Tidypics fracasó"
- -);
- \ No newline at end of file
- +);
- diff --git i/languages/fr.php w/languages/fr.php
- index c18a9ed..5c69204 100755
- --- i/languages/fr.php
- +++ w/languages/fr.php
- @@ -61,7 +61,7 @@ Vous pouvez rencontrer des problèmes avec la création de miniatures si votre b
- 'tidypics:uploader:filedesc' => 'Fichiers image (jpeg, png, gif)',
- 'tidypics:uploader:instructs' => 'Il y a 3 étapes simples pour ajouter des photos à votre album en utilisant cet outil d\'envoi : les choisir, les envoyer, et les décrire.
- Il y a une limite de %s Mo maximum par photo. Si vous n\'utilisez pas Flash, un <a href="%s">autre outil d\'envoi simple</a> est également disponible.',
- - 'tidypics:uploader:basic' => 'Vous pouvez charger jusqu\'à 10 photos à la fois (%s Mo maximum par photo)',
- + 'tidypics:uploader:basic' => 'Vous pouvez charger jusqu\'à %s photos à la fois (%s Mo maximum par photo)',
- 'tidypics:sort:instruct' => 'Triez l\'album photo en cliquant et en déplaçant les images. Puis cliquez sur le bouton Enregistrer.',
- 'tidypics:sort:no_images' => 'Aucune image à trier. Chargez d\'abord des images en cliquant sur le lien ci-dessus.',
- 'album:num' => 'Photos de %s',
- @@ -226,4 +226,4 @@ La photo peut être consultée ici: %s',
- 'album:deletefailed' => 'Votre album ne peut pas être supprimé pour le moment',
- 'album:blank' => 'Donnez un titre et une description à cet album',
- 'tidypics:upgrade:failed' => 'Mise à jour de Tydipics infructueuse',
- -);
- \ No newline at end of file
- +);
- diff --git i/lib/exif.php w/lib/exif.php
- index d1c0e54..0c2cc32 100644
- --- i/lib/exif.php
- +++ w/lib/exif.php
- @@ -23,16 +23,31 @@ function td_get_exif($image) {
- }
- $filename = $image->getFilenameOnFilestore();
- - $exif = exif_read_data($filename, 'IFD0,EXIF', true);
- + $exif = exif_read_data($filename, "ANY_TAG", true);
- if (is_array($exif)) {
- - $data = array_merge($exif['IFD0'], $exif['EXIF']);
- - foreach ($data as $key => $value) {
- - if (is_string($value)) {
- - // there are sometimes unicode characters that cause problems with serialize
- - $data[$key] = preg_replace( '/[^[:print:]]/', '', $value);
- - }
- + // GPS data
- + $gps_exif = array_intersect_key($exif['GPS'], array_flip(array('GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude')));
- +
- + $data = array_merge($exif['IFD0'], $exif['EXIF']);
- + foreach ($data as $key => $value) {
- + if (is_string($value)) {
- + // there are sometimes unicode characters that cause problems with serialize
- + $data[$key] = preg_replace( '/[^[:print:]]/', '', $value);
- + }
- + }
- +
- + if (count($gps_exif) == 4)
- + {
- + if (
- + is_array($gps_exif['GPSLatitude']) and in_array($gps_exif['GPSLatitudeRef'], array('S', 'N')) and
- + is_array($gps_exif['GPSLongitude']) and in_array($gps_exif['GPSLongitudeRef'], array('W', 'E'))
- + )
- + {
- + $data['latitude'] = parse_exif_gps_data($gps_exif['GPSLatitude'], $gps_exif['GPSLatitudeRef']);
- + $data['longitude'] = parse_exif_gps_data($gps_exif['GPSLongitude'], $gps_exif['GPSLongitudeRef']);
- }
- - $image->tp_exif = serialize($data);
- + }
- + $image->tp_exif = serialize($data);
- }
- }
- @@ -106,5 +121,40 @@ function tp_exif_formatted($image) {
- }
- $exif_data['Captured'] = $captured;
- + //if ($exif['latitude'] && $exif['longitude']) {
- + // $exif_data['latitude'] = $exif['latitude'];
- + // $exif_data['longitude'] = $exif['longitude'];
- + //}
- +
- return $exif_data;
- }
- +
- +
- +/**
- + * Converts EXIF GPS format to a float value.
- + * @since 2.6
- + *
- + * @param string[] $raw eg:
- + * - 41/1
- + * - 54/1
- + * - 9843/500
- + * @param string $ref 'S', 'N', 'E', 'W'. eg: 'N'
- + * @return float eg: 41.905468
- + */
- +function parse_exif_gps_data($raw, $ref)
- +{
- + foreach ($raw as &$i)
- + {
- + $i = explode('/', $i);
- + $i = $i[1]==0 ? 0 : $i[0]/$i[1];
- + }
- + unset($i);
- +
- + $v = $raw[0] + $raw[1]/60 + $raw[2]/3600;
- +
- + $ref = strtoupper($ref);
- + if ($ref == 'S' or $ref == 'W') $v= -$v;
- +
- + return $v;
- +}
- +
- diff --git i/start.php w/start.php
- index 4634dc8..c092daa 100644
- --- i/start.php
- +++ w/start.php
- @@ -23,10 +23,14 @@ function tidypics_init() {
- // Register an ajax view that allows selection of album to upload images to
- elgg_register_ajax_view('photos/selectalbum');
- + $menu_item = elgg_get_plugin_setting('default_menu', 'tidypics');
- + if (!$menu_item) {
- + $menu_item = "photos/siteimagesall";
- + }
- // Set up site menu
- elgg_register_menu_item('site', array(
- 'name' => 'photos',
- - 'href' => 'photos/siteimagesall',
- + 'href' => "$menu_item",
- 'text' => elgg_echo('photos'),
- ));
- diff --git i/views/default/forms/photos/admin/settings/main.php w/views/default/forms/photos/admin/settings/main.php
- index 410c4fc..de91b3c 100644
- --- i/views/default/forms/photos/admin/settings/main.php
- +++ w/views/default/forms/photos/admin/settings/main.php
- @@ -47,3 +47,24 @@ echo elgg_view('input/text', array(
- 'value' => $quota,
- ));
- echo '</div>';
- +
- +$max_uploads = intval($plugin->max_uploads);
- +if (!$max_uploads) {
- + $max_uploads = 10;
- +}
- +echo '<div>' . elgg_echo('tidypics:settings:maxuploads');
- +echo elgg_view('input/text', array(
- + 'name' => 'params[max_uploads]',
- + 'value' => $max_uploads,
- +));
- +echo '</div>';
- +
- +echo'<div>';
- +echo elgg_echo('tidypics:settings:default_menu') . ': ';
- +echo elgg_view('input/select', array(
- + 'name' => 'params[default_menu]',
- + 'options' => array ("photos/siteimagesall", "photos/all"),
- + 'value' => $plugin->default_menu,
- +));
- +echo '</div>';
- +
- diff --git i/views/default/forms/photos/ajax_upload.php w/views/default/forms/photos/ajax_upload.php
- index 44b43d4..e710eb7 100644
- --- i/views/default/forms/photos/ajax_upload.php
- +++ w/views/default/forms/photos/ajax_upload.php
- @@ -19,15 +19,20 @@ if (!$maxfilesize) {
- $maxfilesize_int = (int) $maxfilesize;
- +$max_uploads = intval(elgg_get_plugin_setting('max_uploads', 'tidypics'));
- +if (!$max_uploads) {
- + $max_uploads = 10;
- +}
- +
- ?>
- <p>
- <?php
- - echo elgg_echo('tidypics:uploader:instructs', array($maxfilesize));
- + echo elgg_echo('tidypics:uploader:instructs', array($max_uploads, $maxfilesize));
- ?>
- </p>
- -<div id="uploader" data-maxfilesize="<?php echo $maxfilesize_int; ?>">
- +<div id="uploader" data-maxfilesize="<?php echo $maxfilesize_int; ?>" data-max_uploads="<?php echo $max_uploads; ?>">
- <input type="hidden" name="album_guid" value="<?php echo $album->getGUID(); ?>" />
- <input type="hidden" name="batch" value="<?php echo $batch; ?>" />
- <input type="hidden" name="tidypics_token" value="<?php echo $tidypics_token; ?>" />
- diff --git i/views/default/js/tidypics/uploading.js w/views/default/js/tidypics/uploading.js
- index c15903a..d61a439 100644
- --- i/views/default/js/tidypics/uploading.js
- +++ w/views/default/js/tidypics/uploading.js
- @@ -12,8 +12,9 @@ define(function(require) {
- data[name] = value;
- }
- });
- -
- +
- var maxfilesize = $("#uploader").data('maxfilesize');
- + var max_uploads = $("#uploader").data('max_uploads');
- $("#uploader").plupload({
- // General settings
- @@ -53,21 +54,19 @@ define(function(require) {
- },
- FilesAdded: function(up, files) {
- - var maxfiles = 10;
- - if(up.files.length > maxfiles ) {
- - alert(elgg.echo('tidypics:exceedmax_number', [maxfiles]));
- + if(up.files.length > max_uploads ) {
- + alert(elgg.echo('tidypics:exceedmax_number', [max_uploads]));
- }
- - if(up.files.length > maxfiles ) {
- - up.splice(maxfiles);
- + if(up.files.length > max_uploads ) {
- + up.splice(max_uploads);
- }
- - if (up.files.length >= maxfiles) {
- + if (up.files.length >= max_uploads) {
- up.disableBrowse(true);
- }
- },
- FilesRemoved: function(up, files) {
- - var maxfiles = 10;
- - if (up.files.length < maxfiles) {
- + if (up.files.length < max_uploads) {
- up.disableBrowse(false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement