Editing
Radomizing Image Filenames
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Setting image upload randomization== *In the PHP parent record class, set the image object's <code>randomize</code> property value. *Make sure that the value is not overwritten by <code>fill_from_input()</code> unless it's truly intended. <syntaxhighlight lang="php"> class ParentContent extends db_content_class { function __construct() { parent::__construct(); $this->image = new image_upload_class($this->SECTION_ID(), $this->id->value); $this->image->randomize->value = self::RANDOMIZE_IMAGE_FILENAME; /* <<< set randomization here (TRUE or FALSE) */ } public function fill_from_input() { parent::fill_from_input(); $this->image->randomize->value = self::RANDOMIZE_IMAGE_FILENAME; /* <<< make sure the value is not overridden ever */ } } </syntaxhighlight> ==JavaScript/AJAX== ===HTML thumbnail container attributes=== *<code>.gallery-tn-container</code> assigned "click" handler which displays edit and delete buttons. **"click" assignment: <code>LITTLED.Gallery.bindImageOverlayHandlers()</code> **<code>.gallery-tn-container</code> template file: <code>[COMMON_LIB]_templates/forms/images/image_upload_link.php</code> *<code>.gallery-tn-container</code> attributes: **<code>data-id</code> image link record id **<code>data-pid</code> parent record id **<code>data-tid</code> content type id of the parent record **<code>data-op</code> operation, e.g. "upload", "edit", or "delete" **<code>data-rand</code> randomization flag ***Randomization attribute value is assigned by the PHP <code>image_upload_class</code> passed to the thumbnail template ===How the randomization flag value is passed to the AJAX script=== *<code>.gallery-tn-container</code> onClick handler copies its attributes to the edit and delete buttons. *upload/edit button (<code>#edit-galltn-btn</code>) has onClick handler <code>LITTLED.Gallery.selectThumbnail()</code> **randomization flag value is retrieved from the edit button's attributes **randomization flag value is passed to the AJAX script ==Upload script== *Image upload AJAX script: <code>[COMMON_LIB]ajax/images/upload_image.php *parameter <code>ilrf</code> determines randomization, e.g.: <syntaxhighlight lang="text"> /ajax/images/upload_image.php?ilrf=[true|false] </syntaxhighlight> ==PHP code== *<code>image_upload_class->randomize</code> holds value used as switch to randomize image filenames *<code>image_upload_class->randomize</code> set in either <code>image_upload_class::fill_from_input()</code> or <code>image_upload_class::fill_inline_input()</code> *<code>image_upload_class</code> inherits its <code>save()</code> routine from <code>image_link_class::save($saveKeywords=false, $randomizeFilename=false)</code> [[Category:CMS Documentation]] [[Category:Albums CMS]] [[Category:JQuery/AJAX]]
Summary:
Please note that all contributions to Littledamien Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Littledamien Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information